Restrict scrall area in Excel for specific sheets

  oo7juk 00:55 14 Nov 2007

Hi I have a excel workbook containing 7 sheets. At the moment I have one sheet with a code that restricts the scroll area page. I would like to apply similar function to other sheets, but when I insert code by clicking the workbook from the VBA window it just generates an error 'Ambigous name'

I am trying to apply to Sheet3, Sheet4 and Sheet 5. I just copied the above code and replaced (Sheet1) with (Sheet4) and extended the scroll area to A1:K117.

Code that works for Sheet1 -

Private Sub Workbook_Open()
Sheets("Sheet1").ScrollArea = "A1:K103"
End Sub

Many thanks

  oo7juk 11:04 14 Nov 2007


Decided to use the following for workbook. Just means when I have to update sheet I will have to remove scroll function.

Private Sub Workbook_Open()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.ScrollArea = "A1:K117"
Next ws
End Sub


This thread is now locked and can not be replied to.

Elsewhere on IDG sites

WPA2 Hack Latest News: How Secure is your Wi-Fi?

Photoshop CC 2018 released with new Curvature Pen and better brush tools

Best kids apps for iPhone & iPad

Comment utiliser Twitter ?