![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Feb 2002
Location: Austin, TX
Posts: 1
|
This is a continuation from Friday.
This gets partway there. It positions all worksheets the same in the window but doesn't make the same cell the active cell in each. Ideally, it would also return to the sheet that was selected as the active sheet upon completion. : : I got some VBA code from one of the great Excel sites a while back that I can't find now. It caused every worksheet in the workbook to be positioned the same in the window and have the same active cell, i.e. launch it while active cell is FF5000 and every sheet would align with FF5000 in top left of window position. Would truly appreciate if anyone could point me to it again. : : Sub Scroll_To_ActiveCell() : Dim ws As Worksheet, rng As String : rng = ActiveCell.Address(False, False) : Application.ScreenUpdating = False : For Each ws In ActiveWorkbook.Worksheets : ws.Activate : With ActiveWindow : .ScrollRow = Range(rng).Row : .ScrollColumn = Range(rng).Column : End With : Next : End Sub |
|
|
|
|
|
#2 |
|
Legend
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
|
Just need to select the cell, the code below should finalize:
Sub Scroll_To_ActiveCell() Dim ws As Worksheet, rng As String ActiveWorkbook.Names.Add Name:="Money", RefersToR1C1:=Selection rng = ActiveCell.Address(False, False) Application.ScreenUpdating = False For Each ws In ActiveWorkbook.Worksheets ws.Activate Range(rng).Select With ActiveWindow .ScrollRow = Range(rng).Row .ScrollColumn = Range(rng).Column End With Next Application.Goto Reference:="Money" ActiveWorkbook.Names("Money").Delete End Sub Cheers, Nate [ This Message was edited by: NateO on 2002-02-18 12:01 ] |
|
|
|
|
|
#3 |
|
Legend
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
|
Or:
Sub Scroll_To_ActiveCell2() Dim ws As Worksheet, rng As String money = ActiveSheet.Name rng = ActiveCell.Address(False, False) Application.ScreenUpdating = False For Each ws In ActiveWorkbook.Worksheets ws.Activate Range(rng).Select With ActiveWindow .ScrollRow = Range(rng).Row .ScrollColumn = Range(rng).Column End With Next Sheets(money).Select End Sub Cheers, Nate [ This Message was edited by: NateO on 2002-02-18 12:04 ] |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|