Restrict scrall area in Excel for specific sheets

  oo7juk 00:55 14 Nov 07
Locked

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 07

HI,

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

Thnaks,

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

Nintendo Switch review: Hands-on with the intuitive modular console and its disappointing games…

1995-2015: How technology has changed the world in 20 years

This abstract video touches on division in our technologic world

Best alternatives to iTunes for Mac | Best music players for macOS: Free your music from the…