so code have below attempts find wip in column h. if find wip: copy 3 cells , make 10 replicas of them in next column either in same row or next available row.
for reason code runs loop first "wip" value , stops running. can see why keeps happening?
thank you, ori
sub step1_update()
dim dblsku double dim strdesc string dim strtype string dim browfin integer dim browfin1 integer dim counter integer dim trowfin integer counter = 0 worksheets("final").activate trowfin = 5 browfin = activesheet.range("a" & rows.count).end(xlup).row 'loop 1 while trowfin < browfin 'if 1 if range("h" & trowfin).value = range("h3").value dblsku = range("f" & trowfin).value strdesc = range("g" & trowfin).value strtype = range("h" & trowfin).value browfin1 = (activesheet.range("j" & rows.count).end(xlup).row) 'if 2 if browfin1 > trowfin while counter < 15 range("j" & browfin1).value = dblsku range("k" & browfin1).value = strdesc range("l" & browfin1).value = strtype counter = counter + 1 browfin1 = browfin1 - 1 trowfin = trowfin + 1 loop elseif browfin1 < trowfin while counter < 15 range("j" & trowfin).value = dblsku range("k" & trowfin).value = strdesc range("l" & trowfin).value = strtype counter = counter + 1 trowfin = trowfin + 1 loop else while counter < 15 range("j" & trowfin).value = dblsku range("k" & trowfin).value = strdesc range("l" & trowfin).value = strtype counter = counter + 1 trowfin = trowfin + 1 loop 'if 2 end if else trowfin = trowfin + 1 'if 1 end if counter = 0 'loop 1 loop end sub
you need reset counter 0 after loop through it. otherwise @ 15 next time loop again.
Comments
Post a Comment