Ironman
Well-known Member
- Joined
- Jan 31, 2004
- Messages
- 1,069
- Office Version
- 365
- Platform
- Windows
Hi
The below code is giving me the "End if without block if" error but I don't see where the error is.
Also, I cobbled this together from 2 separate bits of code. If this can be improved please feel free to amend it.
Thank you!
The below code is giving me the "End if without block if" error but I don't see where the error is.
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.EnableEvents = False
'Clicking cell CC1 goes to monthly totals and chart
If Not Application.Intersect(Target, Range("CC1")) Is Nothing Then
ActiveWindow.ScrollRow = 57
End If
'Clicking cell AM1 goes to start of month
If Not Application.Intersect(Target, Range("AM1")) Is Nothing Then
With Columns("A:A")
Set c = .Find(Format(Date, "MMM"), LookIn:=xlValues)
If Not c Is Nothing Then
c.Select
ActiveWindow.ScrollRow = c.Row - 1 'the -1 moves the active cell down a row
ActiveWindow.ScrollColumn = c.Column
End If
End If
End With
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
Also, I cobbled this together from 2 separate bits of code. If this can be improved please feel free to amend it.
Thank you!