Hi,
I am fairly new to VBA and am having trouble getting a VLookup function to work (to be honest I don't really understand the error message). The code goes like this:
I am fairly new to VBA and am having trouble getting a VLookup function to work (to be honest I don't really understand the error message). The code goes like this:
Code:
Dim LastPeriodNo As Variant
Dim CODAS_Periods As Range
Set CODAS_Periods = Workbooks("Personal.xls").Worksheets("CODASPeriods").Range("A3:F54")
LastPeriodNo = Application.WorksheetFunction.VLookup(Now(), CODAS_Periods, 2, True)[\CODE]
When I run this I get the error message:
"Run Time Error 1004
Unable to get the VLookup property of the worksheet function class"
It should hopefully look up today's date in a table and get a corresponding period number from the second column. Can anyone explain what this really means and if it is possible to get around it?
Regards,
Alan