I have two Sheets , sheet1 and sheet2 .
Sheet1 has 27 columns, and sheet2 has 10 columns,
I am looking for the Id in sheet 1, column J and Need the corresponding date in sheet 2 , column g.
I Need this corresponding date to be printed in sheet 1 , column AA.
I am using the following belo VBA, it is printing the column D of sheet 2 insted of Column G.
This is the formula,
=IFERROR(VLOOKUP(j2;sheet2!$A:$L;7;0);"")
I dont want to use, record macro functionality. Kindly, help me to correct the code.
Sub lookup()
Dim totalrows As Long
Dim totalcolumn As Long
Dim rng As Range
Dim rng1 As Range
Dim i As Long
totalrows = ActiveSheet.UsedRange.Rows.Count
For i = 2 To totalrows
Sheets("Sheet1").Select
Set rng = Sheets("Sheet2").UsedRange.Find(Cells(i, 10).Value)
If Not rng Is Nothing Then
Cells(i, 27).Value = rng.Value
End If
Next i
End Sub
rng.offset(0,x)
maybe? – Nathan_SavSheets("Sheet2").columns("G").find
you are looking in, then use offset, if needed, it can exist anywhere in the sheet this way. – Nathan_Sav