scroll area

K

kalpesh

Hello


l would like to lock scroll area in sheet1 in range A1:H10 when sheet 1
activat
the code is given unde

Sub LockArea(
Worksheets(1).ScrollArea = "A1:F10
End Su


Private Sub Worksheet_Activate(
Call LockAre
End Su


but problem is when file is close & again open this file scroll area i
unlock so i first select sheet2 & then select sheet1 then scroll area i
loc

i like when every time file is open the sheet 1 scroll area is lock whithou
select sheet

how
 
G

Gord Dibben

Scrollarea is not something that will stay fixed.

As I showed you a couple of days ago you must place that code in
Workbook_Open event.

Add this code to Thisworkbook module.

Private Sub Workbook_Open()
Dim ws As Worksheet
If ActiveSheet.Name = "Sheet1" Then
With ActiveSheet
.ScrollArea = "A1:H10"
End With
End If
Call LockArea
End Sub


Gord
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top