vba - Copying a row in excel from one sheet to another after searching for a given value -
disclaimer... not looking code me, point me in correct direction or give me examples can work with.
problem: have workbook has 2 pages. first if formatted this
hostname chassis service tag asset tab location u lcldhv003-25 pe r610 1*v4yq1 1*1315 d3sf85.08 21 lcmntypxyb02 pe r610 bz00l1 19368 x3sd04.34 36 lemailmig001 pe 1950 9zvsj1 12078 x3se07.12 29 lpasscdb01-01 pe r710 3xsvh1 11415 p3sd02.22 03
i need search in in location field given value (example x3sd04) , insert row second table. need have existing data moved down page.
i have seen vlookup index, match , vba options. have tried has failed.
try this:
sub test() dim searchstring$, cl range, n& searchstring = "x3sd04" n = sheets("sheet2").cells(rows.count, "a").end(xlup).row + 1 'get row insert copied row set cl = sheets("sheet1").cells.find(searchstring) 'find range searchstring if not cl nothing 'if searchstring exist in sheet copy sheets("sheet1").rows(cl.row).copy sheets("sheet2").rows(n) end if end sub
Comments
Post a Comment