Hello everyone
This code breaks on line 1 with that error
This is the call:
The code does work in debug mode and does not work when I let it run with F5.
Can anybody explain why?
Thank you!
This code breaks on line 1 with that error
Code:
Private Sub HideExtrapolatingLines(ByRef ioobjWsht As Worksheet)
Const METHOD_NAME As String = "HideExtrapolatingLines"
On Error GoTo MethodExit
1 ioobjWsht.Rows("307:310").EntireRow.Hidden = True
2 ioobjWsht.Rows("263:268").EntireRow.Hidden = True
3 ioobjWsht.Rows("200:211").EntireRow.Hidden = True
4 ioobjWsht.Rows("157:162").EntireRow.Hidden = True
5 ioobjWsht.Rows("95:105").EntireRow.Hidden = True
6 ioobjWsht.Rows("52:57").EntireRow.Hidden = True
MethodExit:
If Err.Number <> 0 Then
MsgBox "Error " & CStr(Err.Number) & " in " & METHOD_NAME & vbCr & Err.Description & vbCr & Erl
End If
End Sub
This is the call:
Code:
Dim objWsht As Worksheet
HideExtrapolatingLines objWsht
The code does work in debug mode and does not work when I let it run with F5.
Can anybody explain why?
Thank you!