Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Align all worksheets

  1. #1
    New Member
    Join Date
    Feb 2002
    Location
    Austin, TX
    Posts
    1
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #2
    Legend NateO's Avatar
    Join Date
    Feb 2002
    Location
    Minneapolis, Mn, USA
    Posts
    9,700
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #3
    Legend NateO's Avatar
    Join Date
    Feb 2002
    Location
    Minneapolis, Mn, USA
    Posts
    9,700
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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 ]

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •