excel vba - Copying value from 2nd worksheet into first based on matching 1st columns -


i have 2 worksheets 1 single column common in both 1st column of both worksheets. want match columns in both sheets , matching columns ( i.e. sheet1.ax = sheet2.ax) want rows in row sheet 2 last row column of sheet 1 . using below code –

dim lastcol long  dim rng range  dim rng2 range  dim integer  ‘ use cells on sheet  set rng = sheets(“sheet1”).cells  set rng2 = sheets(“sheet2”).cells  ‘ find last column  lastcol = last(2, rng)  ‘ after last column data change value of cell in row 1  = 1 895  rng.parent.cells(i, lastcol + 1).value = rng2.parent.cells(i,1).value  next 

with above code able copy first column sheet2 need copy columns sheet2 1st column in sheet2 same 1st column in sheet1 can please


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -