Hello Guys! Take it easy on me. I'm an intermediate Excel User, but a NOVICE VBA user .
I downloaded an employee leave sheet and have pretty much got it operating as I need it to...EXCEPT... I copied the original "2019-2020 Leave" worksheet (so that I can have a 2020-2021 sheet). But now when I try to use the monthly scroll bars on the newly copied "2020-2021" sheet, I get a debug error. EEEEKKKKK. "Run-time error '1004: Unable to set the Hidden property of the Range class"
.....Please help!
Here's a link to the sheet : Leave Sheet
Here's the code: Red letters are of course highlighted in yellow inVBA:
Sub PreviousMonth()
ActiveSheet.Unprotect "MHVhr20"
If ActiveSheet.Range("A3").Value = 1 Then
GoTo Finish
Else:
Range("A3").Value = Range("A3").Value - 1
LeaveTracker.Columns("B:NI").Hidden = True
LeaveTracker.Range(Columns(Range("A3").Value * 31 - 29), Columns(Range("A3").Value * 31 + 1)).Hidden = False
End If
Finish: ActiveSheet.Protect "MHVhr20"
End Sub
I downloaded an employee leave sheet and have pretty much got it operating as I need it to...EXCEPT... I copied the original "2019-2020 Leave" worksheet (so that I can have a 2020-2021 sheet). But now when I try to use the monthly scroll bars on the newly copied "2020-2021" sheet, I get a debug error. EEEEKKKKK. "Run-time error '1004: Unable to set the Hidden property of the Range class"
.....Please help!
Here's a link to the sheet : Leave Sheet
Here's the code: Red letters are of course highlighted in yellow inVBA:
Sub PreviousMonth()
ActiveSheet.Unprotect "MHVhr20"
If ActiveSheet.Range("A3").Value = 1 Then
GoTo Finish
Else:
Range("A3").Value = Range("A3").Value - 1
LeaveTracker.Columns("B:NI").Hidden = True
LeaveTracker.Range(Columns(Range("A3").Value * 31 - 29), Columns(Range("A3").Value * 31 + 1)).Hidden = False
End If
Finish: ActiveSheet.Protect "MHVhr20"
End Sub