Runtime error - goto
Works fine for me in 2003 and 2007 with no runtime error.
I would suggest qualifying WorkSheets just to be on safe side.
For Each sht In ThisWorkbook.Worksheets
Otherwise.............OK
Gord Dibben MS Excel MVP
On Sat, 12 Dec 2009 13:34:01 -0800, Trish Smith
wrote:
Hi,
I've tried to combine 2 macros that I've used successfully separately.
The first one protects the user interface and the second resets sheets to A2
Private Sub Workbook_Open()
Dim sht As Worksheet
Application.ScreenUpdating = False
For Each sht In Worksheets
Const TopLeft As String = "A2"
sht.Protect Password:="*9reh8", _
UserInterFaceOnly:=True
Application.Goto sht.Range(TopLeft), Scroll:=True
Next sht
Application.ScreenUpdating = True
End Sub
Could anyone tell me where I'm going wrong please
Many thanks
|