ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   error 424 - Object Required (https://www.excelbanter.com/excel-programming/278496-error-424-object-required.html)

blb

error 424 - Object Required
 
I receive this error message sometimes while running the code below.
Out perhaps 1200 hits on this code it may error 2 or three times. Can
anyone see where the potential for error 424 would be?

Thanks!

Sub FreezePanes()
On Error GoTo ErrorHandler
If ActiveWindow.FreezePanes = False Then
MsgBox prompt:="The area to the left and top of the current
cell will be 'frozen'." & Chr(10) & _
"Select this menu option again to 'unfreeze'.",
Title:="CAP - Freeze Panes"
FreezeMenu.caption = "Un&freeze Panes"
Else
FreezeMenu.caption = "&Freeze Panes"
End If
ActiveWorkbook.Unprotect
ActiveWindow.FreezePanes = Not (ActiveWindow.FreezePanes)
ActiveWorkbook.Protect Windows:=True
Exit Sub
ErrorHandler:
Catch ThisWorkbook.Name, "FreezePanes"
End Sub


All times are GMT +1. The time now is 04:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com