rossmiddleto
01-19-2011, 08:25 AM
I am trying to obtain a value in a table based on todays date and save that value in the string variable 'unit' with the following code:
Sub test2()
Dim rng As Range
Dim unit As String
Dim target As Date
target = Format(Date, "dd/mm/yyy")
Set rng = Sheets("CMTD_CALC").Columns("A:C")
unit = WorksheetFunction.VLookup(target, rng, 3, False)
End Sub
The error that I get is:
'Invalid procedure or call argument'
Any help would be more than appreciated.
Thanks
Sub test2()
Dim rng As Range
Dim unit As String
Dim target As Date
target = Format(Date, "dd/mm/yyy")
Set rng = Sheets("CMTD_CALC").Columns("A:C")
unit = WorksheetFunction.VLookup(target, rng, 3, False)
End Sub
The error that I get is:
'Invalid procedure or call argument'
Any help would be more than appreciated.
Thanks