The below macro is updating fuel prices for a given month which can be in the current year, the last or the next one.
The user gets one form to select the month of the update, then another form to select Current Year / Last Year / Next Year.
Current Year and Last Year macros are working fine.
The purpose of the Next Year macro is to check on the Fuel Price list if the year already exists - If Not, add a new cell with "2015"
If the year is already entered, the macro will then check if the month selected on the first form already exists - If Not add a new cell with the month selected.
Here is the macro :
![]()
Please Login or Register to view this content.
On the line : Set YearFound = .Find(what:=Year(Date) + 1, after:=Range("A1"), LookIn:=xlValues, lookat:=xlWhole, _
searchorder:=xlByColumns, searchdirection:=xlNext, MatchCase:=False, matchbyte:=False, searchformat:=False).Activate
I am getting a Run Time Error 91, and I cannot find why.
Thanks !
Bookmarks