dont know how to read this to sort it out

alan myers

Board Regular
Joined
Oct 31, 2017
Messages
119
Office Version
  1. 365
Platform
  1. 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
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Try answering my question. ;)
 
Upvote 0
Ok what exactly is in that cell when you get the error?
 
Upvote 0

Forum statistics

Threads
1,216,070
Messages
6,128,612
Members
449,460
Latest member
jgharbawi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top