Hi, I was using the following code to fill a specific cell but not I want to autofill until the end. I'm unable to figure out how to solve this
Sub Test()
LastRow = Sheets("Existing 2W").Range("B" & Rows.Count).End(xlUp).Row
Sheets("Existing 2W").Range("S1").Interior.ColorIndex = 5 ' 3 indicates Red Color
''''The following two lines are working fine to fill the S2 cell but now I want to fill S2:S
'Sheets("Existing 2W").Range("S2").Value = WorksheetFunction.Index(Range("Latest_Range"), WorksheetFunction.Match(Left(Right((Sheets("Existing 2W").Range("Z2").Value), 11), 5), Range("LatestLineNo"), 0), 11)
'Sheets("Existing 2W").Range("S2").Value = Application.Index(Range("Latest_Range"), Application.Match(Left(Right((Sheets("Existing 2W").Range("Z2").Value), 11), 5), Range("LatestLineNo"), 0), 11)
For i = 1 To LastRow
'Sheets("Existing 2W").Cells(1, i + 1) = rs.Fields(i).Name
Sheets("Existing 2W").Cells(1, i + 1).Value = Application.Index(Range("Latest_Range"), Application.Match(Left(Right((Sheets("Existing 2W").Cells(19, i + 1).Value), 11), 5), Range("LatestLineNo"), 0), 11)
Next i
End Sub