Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 921
Default Make all sheets scroll to top when I protect them...

I have a macro that protects all sheets (and it does a few other things at
the same time):

I would like to include some code that make all the sheets scroll to the
top. I tried adding "ws.Range("O1").Select" but that doesn't work.

Sub Protect1_Click()
For Each ws In Worksheets
ws.Range("O29:Z29").Interior.ColorIndex = 2
ws.Shapes("Date Hired").LockAspectRatio = msoFalse
ws.Shapes("Date Hired").Height = 28.5
ws.Shapes("Date Hired").Width = 112.5
ws.Shapes("Unprotect1").ZOrder msoBringToFront
ws.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Next
End Sub

Thanks in advance,
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 913
Default Make all sheets scroll to top when I protect them...

On Fri, 28 Mar 2008 22:39:00 -0700, Jeff
wrote:

I have a macro that protects all sheets (and it does a few other things at
the same time):

I would like to include some code that make all the sheets scroll to the
top. I tried adding "ws.Range("O1").Select" but that doesn't work.

Sub Protect1_Click()
For Each ws In Worksheets
ws.Range("O29:Z29").Interior.ColorIndex = 2
ws.Shapes("Date Hired").LockAspectRatio = msoFalse
ws.Shapes("Date Hired").Height = 28.5
ws.Shapes("Date Hired").Width = 112.5
ws.Shapes("Unprotect1").ZOrder msoBringToFront
ws.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Next
End Sub

Thanks in advance,



Try this sub:

Sub Scroll_all_sheets_to_top()
Set a = ActiveSheet
For Each ws In Worksheets
ws.Activate
ActiveWindow.ScrollIntoView 0, 0, 0, 0
Next ws
a.Activate
End Sub

Hope this helps. / Lars-Åke
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Make all sheets scroll to top when I protect them...

You want O1 to be top left cell on each sheet?

Adjust Lars' code to this.

Sub Scroll_all_sheets_to_top()
Set a = ActiveSheet
For Each ws In Worksheets
ws.Activate
ActiveWindow.ScrollRow = 1
ActiveWindow.ScrollColumn = 15
Next ws
a.Activate
End Sub


Gord Dibben MS Excel MVP

On Fri, 28 Mar 2008 22:39:00 -0700, Jeff wrote:

I have a macro that protects all sheets (and it does a few other things at
the same time):

I would like to include some code that make all the sheets scroll to the
top. I tried adding "ws.Range("O1").Select" but that doesn't work.

Sub Protect1_Click()
For Each ws In Worksheets
ws.Range("O29:Z29").Interior.ColorIndex = 2
ws.Shapes("Date Hired").LockAspectRatio = msoFalse
ws.Shapes("Date Hired").Height = 28.5
ws.Shapes("Date Hired").Width = 112.5
ws.Shapes("Unprotect1").ZOrder msoBringToFront
ws.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Next
End Sub

Thanks in advance,


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 921
Default Make all sheets scroll to top when I protect them...

Thank you, Lars & Gord for your help with this. It actually helps me in a lot
more ways than just solving this problem, it gave me different way to look at
things. I really appreciate that!

"Gord Dibben" wrote:

You want O1 to be top left cell on each sheet?

Adjust Lars' code to this.

Sub Scroll_all_sheets_to_top()
Set a = ActiveSheet
For Each ws In Worksheets
ws.Activate
ActiveWindow.ScrollRow = 1
ActiveWindow.ScrollColumn = 15
Next ws
a.Activate
End Sub


Gord Dibben MS Excel MVP

On Fri, 28 Mar 2008 22:39:00 -0700, Jeff wrote:

I have a macro that protects all sheets (and it does a few other things at
the same time):

I would like to include some code that make all the sheets scroll to the
top. I tried adding "ws.Range("O1").Select" but that doesn't work.

Sub Protect1_Click()
For Each ws In Worksheets
ws.Range("O29:Z29").Interior.ColorIndex = 2
ws.Shapes("Date Hired").LockAspectRatio = msoFalse
ws.Shapes("Date Hired").Height = 28.5
ws.Shapes("Date Hired").Width = 112.5
ws.Shapes("Unprotect1").ZOrder msoBringToFront
ws.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Next
End Sub

Thanks in advance,



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
Can I make the scroll bar show the row number? Marcia Duckworth Excel Discussion (Misc queries) 11 June 20th 07 08:33 PM
no scroll bars or tab sheets Bonny Excel Worksheet Functions 3 October 12th 06 05:05 PM
have sheets 2 and 3 scroll the same when scrolling sheet 1? billy boy Excel Discussion (Misc queries) 11 December 14th 05 03:27 PM
Can you make all sheets scroll when scrolling one sheet billy boy Excel Worksheet Functions 1 November 23rd 05 06:56 PM
How do I make a row or information, follow as you scroll down..? Dave_86 Excel Worksheet Functions 2 May 11th 05 03:33 PM


All times are GMT +1. The time now is 08:34 AM.

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

About Us

"It's about Microsoft Excel"