Hello everyone,
My VBA code starts like this:
Sub Refresh()
Dim LastRunWeek As Long, LastRunDate As Date
Dim CurrentWeek As Long, CurrentYear As Long
LastRunDate = Sheets(1).Range("M8")
LastRunWeek = Application.WorksheetFunction.WeekNum(LastRunDate)
CurrentWeek = Application.WorksheetFunction.WeekNum(Date)
If CurrentWeek = LastRunWeek Then
The purpose of this section is to check the date between today and the date the macro was last run (Cell M8). And it worked perfectly on my computer. But after my boss opened it, run it and renamed it (the file remained in the same folder) I can't run the macro anymore. I get the following error: Run-time error '13': Type mismatch. When I click on debug, it has problem with this line:
LastRunDate = Sheets(1).Range("M8")
Maybe my boss and I have different version of Excel, could this cause the problem? Possibly I made some mistakes in the declaration phase. It is really annoying that it worked and now it doesn't.
Can anyone help me in this?
Thank you in advance,
Mark