Hi All,
I'm having trouble getting my vlookup formula to work in vba. Basically, I have a range of dates in column A and want to the vlookup to fill these in until there are no dates available. The reason I want to do this in VBA opposed to on the spreadsheet, is that I have large subset of time series data which needs to be frequently updated and wish for the data in column C to be updated everytime the macro is run.
My code is below. I keep on getting a runtime error 13 on the highlighted line below. Any input would be great!
Sub updated()
Dim i As Integer
Dim D As Date
i = 1
D = Cells(i, 1).Value
Do Until D = ""
D = Cells(i, 1).Value
Cells(i, 3).Value = WorksheetFunction.VLookup(D, "Pricelist", 2, 0)
i = i + 1
Loop
End Sub
Bookmarks