alan myers
Board Regular
- Joined
- Oct 31, 2017
- Messages
- 119
- Office Version
- 365
- Platform
- Windows
the error is in red I don't know how to read this to sort it out
Private Sub Worksheet_Calculate()
Dim rng As Range
Dim cell As Range
Dim fr As Long
Dim lr As Long
' Set range equal to all of column B down to last row of data
Set rng = Range("B2:B" & Cells(Rows.Count, "B").End(xlUp).Row)
' Loop through all cells in column B
For Each cell In rng
' Capture rows to update
fr = Cells(cell.Row, "C").Value
lr = Cells(cell.Row, "D").Value
' Determine to hide or unhide rows
Select Case UCase(cell)
Case "Y"
Sheets("Cover Sheet").Rows(fr & ":" & lr).Hidden = True
Case "N"
Sheets("Cover Sheet").Rows(fr & ":" & lr).Hidden = False
End Select
Next cell
End Sub
my file https://www.mediafire.com/file/qanm3q1r1q6j4yc/Payroll+v7.1.xlsm/file
Private Sub Worksheet_Calculate()
Dim rng As Range
Dim cell As Range
Dim fr As Long
Dim lr As Long
' Set range equal to all of column B down to last row of data
Set rng = Range("B2:B" & Cells(Rows.Count, "B").End(xlUp).Row)
' Loop through all cells in column B
For Each cell In rng
' Capture rows to update
fr = Cells(cell.Row, "C").Value
lr = Cells(cell.Row, "D").Value
' Determine to hide or unhide rows
Select Case UCase(cell)
Case "Y"
Sheets("Cover Sheet").Rows(fr & ":" & lr).Hidden = True
Case "N"
Sheets("Cover Sheet").Rows(fr & ":" & lr).Hidden = False
End Select
Next cell
End Sub
my file https://www.mediafire.com/file/qanm3q1r1q6j4yc/Payroll+v7.1.xlsm/file