View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Trish Smith Trish Smith is offline
external usenet poster
 
Posts: 49
Default Runtime error - goto

Hi Frank,

Thanks for replying
I've worked it out - one of my sheets had a merged range at A1:A6.

Thank you

--
Trish


"Frank K" wrote:

Try moving the line Const TopLeft as String="A2" to just below the Dim sht line
--
Frank K


"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
--
Trish