excel - How do I write a code to copy data from one sheet to another when "x" is found and not duplicate -
i trying figure out how macro copy data 1 sheet titled used car log onto sheet titled used pending when x found in column l on used car log. if x found in column l need data in cells b through k (on row) copied onto used pending corresponding columns b through k. need find next blank row insert , need not duplicate data. appreciated! using excel 2007.
the code below ask for, not more that. sets value in l column xx (instead of x) not copy data twice, , assumes x-es in l column in order, of course false assumption.
sub copydata() dim run boolean dim integer = 1 run = true while run if worksheets("used car log").range("l" + cstr(i)).value = "x" worksheets("used pending").range("b" + cstr(i) + ":k" + cstr(i)).value = worksheets("used car log").range("b" + cstr(i) + ":k" + cstr(i)).value 'mark value copied setting value in column l xx worksheets("used car log").range("l" + cstr(i)).value = "xx" elseif worksheets("used car log").range("l" + cstr(i)).value = "" run = false end if = + 1 wend end sub
Comments
Post a Comment