I have a function that finds the current date in a range and returns the cell in which it's found. I'm trying to use that cell's position to calculate an offset within a subroutine. However, when I run the macro, I get objected required as an error. The function and the subroutine are as shown:
Function findCurrentDate() As Range Dim needle As Date Dim rng As Range needle = CLng(Date) Dim haystack As Range Dim search As Range Set haystack = Range("B3:B86") Set search = haystack.Find(needle, After:=haystack(1), _ LookIn:=xlValues, Lookat:=xlWhole, _ SearchOrder:=xlNext, MatchByte:=True) End Function Sub showFutureWeeklyHours() Dim wkday_row_offset As Integer Dim search As Range Set search = findCurrentDate() Set wkday_row_offset = search.Row ... End Sub This isn't the complete subroutine, but it's enough to reproduce the error. The list of dates are stored in cells B3:B86