Solved

Scroll Multiple Sheets in Excel 2010

Posted on 2013-12-23
15
375 Views
Last Modified: 2013-12-26
Hi,

I'm wondering if there is a way to scroll to the same place over multiple sheets in EXCEL.  I have about 25 sheets each week that I would like to start at the same place.
0
Comment
Question by:drozeveld
  • 7
  • 4
  • 4
15 Comments
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 39736048
Have you tried

Ctrl-PgUp
Ctrl-PgDn
0
 
LVL 1

Author Comment

by:drozeveld
ID: 39736052
Thank you for responding, but I guess I need to better explain what I would like to be able to do.

When I have all the worksheets highlighted in my workbook, I would like to scroll the pages so that cell A1 is showing when I go to each page, which is what can be done with Ctrl-PgUp and Ctrl-PgDn.
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 39736072
You want to switch worksheets and when you do that you need the cursor to move to A1 of that sheet?
0
 
LVL 1

Author Comment

by:drozeveld
ID: 39736090
Yes, but I don't want to press Ctrl-Home on every sheet.
0
 
LVL 1

Author Comment

by:drozeveld
ID: 39736100
Actually the cell that I want to be able to see is F31.  Some worksheets are showing A1, some are showing where the cursor is at in F31.  If I scroll to the bottom of the worksheet on the first page, then I want all the other worksheets to be in the same place so that I can view those cells too.
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 39736103
Are you familiar with macros?

Enter this code in the "Workbook" module of your workbook.
I do think this could be a nuisance at times.

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Range("A1").Select
End Sub

Open in new window

0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 39736107
Ok now this is a different requirement which came before I posted a response to the previous comment.
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 80

Accepted Solution

by:
byundt earned 500 total points
ID: 39737417
The following macro (which must be installed in the ThisWorkbook code pane) will synchronize the scroll row, scroll column and active cell as you switch from one worksheet to another.
'Put the following code in ThisWorkbook code pane. It won't work at all if installed anywhere else
Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
Dim ws As Worksheet
Dim iCol As Long, iRow As Long
Set ws = ActiveSheet
If ws.Parent Is ThisWorkbook Then
    Application.EnableEvents = False
    Application.ScreenUpdating = False
    Sh.Select
    iRow = ActiveWindow.ScrollRow
    iCol = ActiveWindow.ScrollColumn
    Application.Goto ws.Range(ActiveCell.Address)
    ActiveWindow.ScrollRow = iRow
    ActiveWindow.ScrollColumn = iCol
    Application.EnableEvents = True
End If
End Sub

Open in new window

0
 
LVL 1

Author Comment

by:drozeveld
ID: 39740508
This is already in ThisWorkbook:

Public Sub SaveAsA1()
    ThisFile = Range("A1").VALUE
    ActiveWorkbook.SaveAs Filename:=ThisFile
End Sub


Do I remove that?
0
 
LVL 80

Expert Comment

by:byundt
ID: 39740556
Whether or not you move (or delete) SaveAsA1 is up to you. It can remain in its current location and will not interfere with the Workbook_SheetDeactivate event sub I suggested.  

That said, it is considered good practice to put only event-driven subs in class modules like ThisWorkbook. If you follow this good practice, you would move SaveAsA1 into a regular module sheet (use Insert...Module to create one if you don't already have a Module1, Module2, etc.).

If you make this move, you will see the macro listed as "SaveAsA1" in the ALT + F8 macro selector rather than "ThisWorkbook!SaveAsA1"
0
 
LVL 1

Author Comment

by:drozeveld
ID: 39740573
How do I make sure that your macro only goes into this workbook?
0
 
LVL 80

Expert Comment

by:byundt
ID: 39740719
Did you try the code?

I anticipated your question with statement 6, and it will only synchronize worksheets in the workbook containing the macro.
0
 
LVL 1

Author Comment

by:drozeveld
ID: 39740762
It did not work like I am hoping to see it work.


I had the file that I want it to work on open, found ThisWorkbook by going to Developer and opened Visual Basic.

Tried it - didn't work.  Closed that file and opened another file to see if the macro I referred to above was in another workbook, because I'm not sure what it is trying to do there and found that it was and also the one you gave me was there too....therefore, I'm not wondering if I inserted it correctly.
0
 
LVL 80

Expert Comment

by:byundt
ID: 39740783
When you open the workbook, you must enable macros. The code won't work if you don't. Try closing the workbook and then reopening it. You should see a warning about macros.

If that approach still isn't working for you, please post your workbook. I'll make sure the code is installed correctly.

Brad
0
 
LVL 1

Author Comment

by:drozeveld
ID: 39740796
Sometimes...when you review your own work, you find that you put the macro in ThisWorkbook of your personal.xls files, and not just the workbook that you had open.  When you review this, and move the macro to the correct place - it works EXACTLY like you want it to.

Thank you!!
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Pivot help 3 21
Problem to open Excel file 15 38
Recurring Excel Timelime for Veeam 2 31
Splitting out Data 14 27
A2 = A1 That kind of cell reference is relative.  If you copy it from A2 to B2, then B2 will get this: B2 = B1 That's all fine and good, but if you then insert a new row above row 2, you'll find: A3 = A1 B3 = B1 This is intentional. …
Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now