vba - Vlookup from other sheet into blank alternate rows -
i trying use below vlookup
data first column(a1)
of alternate rows , trying retrieve the entire row (the sheet blank alternatively):
'sub applyformulae() dim long, col long dim lastrow long, last_column long worksheets("sheet2") lastrow = .cells.find("*", searchorder:=xlbyrows, searchdirection:=xlprevious).row = 5 lastrow step 2 last_column = .cells(i, .columns.count).end(xltoleft).column ' last column in current row ' loop through columns col = 1 (last_column + 1) .cells(i, 1).formular1c1 = "=vlookup(r[-1]c1,cmrs!c1:c4,column(sheet1!c:c[3]),false)" .cells(i, 2).formular1c1 = "=vlookup(r[-1]c1,cmrs!c1:c4,column(sheet1!c:c[3]),false)" .cells(i, 3).formular1c1 = "=vlookup(r[-1]c1,cmrs!c1:c4,column(sheet1!c:c[3]),false)" .cells(i, 4).formular1c1 = "=vlookup(r[-1]c1,cmrs!c1:c4,column(sheet1!c:c[3]),false)" next col next end end sub'
this works fine takes long time.
is possible make faster?
appreciate help!
Comments
Post a Comment