still learning
Well-known Member
- Joined
- Jan 15, 2010
- Messages
- 784
- Office Version
- 365
- Platform
- Windows
Hi
I have a macro that is part of “Private Sub Workbook_Open()” which finds the current month then goes to the current day. Then it scrolls the page so the range (month) is at the top left.
If I change>>>> Set C = Cells…………
To
The macro works.
I can’t remember if this happens every may.
It’s not hard to change once a year, but I wonder if there is a better way
I think it gives an error because MAY is also a column
mike
I have a macro that is part of “Private Sub Workbook_Open()” which finds the current month then goes to the current day. Then it scrolls the page so the range (month) is at the top left.
VBA Code:
Private Sub Workbook_Open()
gotodatemonth
gotodateday
Application.Goto Reference:=Range(Format(Date, "mmmm")), Scroll:=True
End Sub
VBA Code:
Sub gotodatemonth()
Dim C As Range
Set C = Cells.Find(Month)
‘The line>>>Set C = Cells.find(Month)<<<< causes an error >>“argument not optional”
If Not C Is Nothing Then C.Select
End Sub
VBA Code:
Sub gotodateday()
Dim C As Range
Set C = Range("B1:O1300").Find(Date)
If Not C Is Nothing Then C.Select
End Sub
To
VBA Code:
Application.Goto Reference:="may"
I can’t remember if this happens every may.
It’s not hard to change once a year, but I wonder if there is a better way
I think it gives an error because MAY is also a column
mike