Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 465
Default Workbook sheet code delay


Hi

I'm using this code (placed as a ThisWorkbook module) to restrict the
scroll area in the five worksheets in my workbook :


Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim mysheets As Sheets
Set mysheets = Worksheets(Array(1, 2, 3, 4, 5))
For Each Sheet In mysheets
Sheet.ScrollArea = "A1:O58"
Next
End Sub


Unfortunately , I find it doesn't work immediately the workbook is
opened :

If go to use the first worksheet , it allows scrolling in all directions
without limit. This isn't the idea.....!

If I click onto the second sheet , the restrictions from the code apply.


If I then go back to the first sheet , the restrictions are now in
force.

Is there any way I can get this to work properly and be in force from
when the workbook opens?


Grateful for any help.



Best Wishes


Colin
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,339
Default Workbook sheet code delay

try this in Thisworkbook:


Private Sub Workbook_Open()
Dim mysheets As Sheets
Set mysheets = Worksheets(Array(1, 2, 3,4,5))
For Each Sheet In mysheets
Sheet.ScrollArea = "A1:O58"
Next
End Sub


"Colin Hayes" wrote in message
...

Hi

I'm using this code (placed as a ThisWorkbook module) to restrict the
scroll area in the five worksheets in my workbook :


Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim mysheets As Sheets
Set mysheets = Worksheets(Array(1, 2, 3, 4, 5))
For Each Sheet In mysheets
Sheet.ScrollArea = "A1:O58"
Next
End Sub


Unfortunately , I find it doesn't work immediately the workbook is opened
:

If go to use the first worksheet , it allows scrolling in all directions
without limit. This isn't the idea.....!

If I click onto the second sheet , the restrictions from the code apply.


If I then go back to the first sheet , the restrictions are now in force.

Is there any way I can get this to work properly and be in force from when
the workbook opens?


Grateful for any help.



Best Wishes


Colin



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 465
Default Workbook sheet code delay


Hi

OK that's fixed it - thanks!

Much appreciated.



Best Wishes


Colin




In article , toppers
writes
try this in Thisworkbook:


Private Sub Workbook_Open()
Dim mysheets As Sheets
Set mysheets = Worksheets(Array(1, 2, 3,4,5))
For Each Sheet In mysheets
Sheet.ScrollArea = "A1:O58"
Next
End Sub


"Colin Hayes" wrote in message
...

Hi

I'm using this code (placed as a ThisWorkbook module) to restrict the
scroll area in the five worksheets in my workbook :


Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim mysheets As Sheets
Set mysheets = Worksheets(Array(1, 2, 3, 4, 5))
For Each Sheet In mysheets
Sheet.ScrollArea = "A1:O58"
Next
End Sub


Unfortunately , I find it doesn't work immediately the workbook is opened
:

If go to use the first worksheet , it allows scrolling in all directions
without limit. This isn't the idea.....!

If I click onto the second sheet , the restrictions from the code apply.


If I then go back to the first sheet , the restrictions are now in force.

Is there any way I can get this to work properly and be in force from when
the workbook opens?


Grateful for any help.



Best Wishes


Colin




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 465
Default Workbook sheet code delay

In article , toppers
writes
try this in Thisworkbook:


Private Sub Workbook_Open()
Dim mysheets As Sheets
Set mysheets = Worksheets(Array(1, 2, 3,4,5))
For Each Sheet In mysheets
Sheet.ScrollArea = "A1:O58"
Next
End Sub



Hi

Just as an extra comment on this :

One thing I've noticed with this code is that , once in place , it
inhibits the choice of rows and columns entirely. You just can't select
them.

Is there anyway of avoiding this when scrolling restriction is in place?

Thanks again





"Colin Hayes" wrote in message
...

Hi

I'm using this code (placed as a ThisWorkbook module) to restrict the
scroll area in the five worksheets in my workbook :


Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim mysheets As Sheets
Set mysheets = Worksheets(Array(1, 2, 3, 4, 5))
For Each Sheet In mysheets
Sheet.ScrollArea = "A1:O58"
Next
End Sub


Unfortunately , I find it doesn't work immediately the workbook is opened
:

If go to use the first worksheet , it allows scrolling in all directions
without limit. This isn't the idea.....!

If I click onto the second sheet , the restrictions from the code apply.


If I then go back to the first sheet , the restrictions are now in force.

Is there any way I can get this to work properly and be in force from when
the workbook opens?


Grateful for any help.



Best Wishes


Colin

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Workbook sheet code delay

Try keeping that code in the same module (ThisWorkbook).

But rename it to:
Sub Workbook_Open()

Colin Hayes wrote:

Hi

I'm using this code (placed as a ThisWorkbook module) to restrict the
scroll area in the five worksheets in my workbook :

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim mysheets As Sheets
Set mysheets = Worksheets(Array(1, 2, 3, 4, 5))
For Each Sheet In mysheets
Sheet.ScrollArea = "A1:O58"
Next
End Sub

Unfortunately , I find it doesn't work immediately the workbook is
opened :

If go to use the first worksheet , it allows scrolling in all directions
without limit. This isn't the idea.....!

If I click onto the second sheet , the restrictions from the code apply.

If I then go back to the first sheet , the restrictions are now in
force.

Is there any way I can get this to work properly and be in force from
when the workbook opens?

Grateful for any help.

Best Wishes

Colin


--

Dave Peterson


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Long delay opening a workbook through our Intranet for some users Jacques Trépanier Links and Linking in Excel 0 April 20th 07 08:58 PM
Help...Code to copy sheet from closed workbook [email protected] Excel Discussion (Misc queries) 1 March 28th 07 08:52 PM
VB code to copy sheet format to another sheet ASU Excel Discussion (Misc queries) 12 August 10th 06 02:37 AM
Long Time Delay To Paste From UserForm To Sheet Minitman Excel Worksheet Functions 7 December 6th 05 12:30 AM
copy and paste using code from workbook to workbook bigdaddy3 Excel Discussion (Misc queries) 2 September 14th 05 11:06 AM


All times are GMT +1. The time now is 04:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"