In Excel trying to update rows in Sheet 1 from Sheet 2 based on a unique id found in both sheets -
my question similar found on forum, can't quite work. have master sheet in excel has data many columns , rows. happens is, receive updated data via excel sheets , need update master sheet based on unique id, found in both sheets. not cells have new data, update cells have changed.
what have found far works, isn't updating cells. i'm new vba, appreciated. if code not should doing i'm willing scrap , start scratch.
here code found on forum, can't quite need. have tried changing slightly, no avail. have included code appears in forum. appreciated.
dim sh1 worksheet dim rw2 range set sh1 = worksheets("sheet1") each rw2 in sheets("sheet2").usedrange.rows if not sh1.usedrange.columns(1).find(rw2.cells(1, 2).value,, xlvalues, xlwhole) nothing rw2.cells(1, 5) = sh1.usedrange.columns(1).find(rw2.cells(1, 2).value,, xlvalues, xlwhole).offset(0, 6) end if next rw2
this doesnt need vba macro unless multitude of files.
use formula:
=index(table,match(variables, array, 0),match(variables, array, 0))
if same process everytime use personal code similar task. adjust formula, worksheet, ranges.
dim kcformula string kcformula = "=if(or(table3[[#this row],[status]]=" & """rejected""" & "," & "table3[[#this row],[status]] =" & """completed""" & "," & "table3[[#this row],[status]]=" & """not implemented""" & ")," & """ """ & ",index('amllast'!$1:$1048576,match(table3[[#this row],[id]],'amllast'!$e:$e,0),11))" lastrow = activesheet.usedrange.rows.count sheets("aml") myrng = "k2:" & "k" & lastrow sheets("aml").range(myrng).numberformat = "general" sheets("aml").range(myrng).formula = kcformula end
Comments
Post a Comment