Reputation: 11
I have a date in sheet 'dashboard' M1. and I need to match this in a range in 'HDCinput' cells A33:A833. When I run the below code (part of a bigger macro) I get a "Object variable or With block variable not set". I'm not sure why
Dim mydate As Date
Dim myrange As Range
Dim Colindex As Long
mydate = Sheets("Dashboard").Range("M1")
myrange = Sheets("HDCInput").Range("A3:A833")
Colindex = Application.WorksheetFunction.Match(mydate, myrange, 0)
Upvotes: 0
Views: 288
Reputation: 987
You have to Set
Range Objects:
Set myrange = Sheets("HDCInput").Range("A3:A833")
Not further tested, but this should solve that particular error.
Upvotes: 1