Hey!
I am using the following code, to jump to the first day of the month.
The buttons includes the name of the month ("Jan"...).
It works perfectly at my computer, but not on others.
There is always an error: Method 'Range' of object'_Global' failed on the "Set vRange = Range("TblOP[[#Headers],[" & vDate & "]]")"
Do you know why?
I am using the following code, to jump to the first day of the month.
The buttons includes the name of the month ("Jan"...).
It works perfectly at my computer, but not on others.
There is always an error: Method 'Range' of object'_Global' failed on the "Set vRange = Range("TblOP[[#Headers],[" & vDate & "]]")"
Do you know why?
Code:
Sub PrcCurrentMonth()
Dim vNumber As Long
Dim vDate As Date
Dim vMonth As Variant
Dim vRange As Range
vMonth = ActiveSheet.Shapes(Application.Caller).DrawingObject.Caption
vNumber = WorksheetFunction.Match(vMonth, Application.GetCustomListContents(7), 0)
vDate = DateSerial(2019, vNumber, 1)
Set vRange = Range("TblOP[[#Headers],[" & vDate & "]]")
If Not vRange Is Nothing Then
Application.Goto vRange, True
Set vRange = Nothing
End If
End Sub
Last edited: