Grouped Sheets - Windows Arrange

  • Thread starter Thread starter JMay
  • Start date Start date
J

JMay

Is it be possible to Select a given number of Sheets (Group,
NonContiguous limit to two) say for example sheet1 and sheet3) and run a
macro that would Show them Vertically arranged?

Any assistance appreciated,
 
Jim

You can certainly show multiple windows vertically.

I see no way of grouping a couple of sheets and getting each to be in a new
window.


Gord Dibben MS Excel MVP
 
I think Dave F. was answering a question about arranging the tabs at the bottom
of the window--not arranging the actual windows themselves.

Maybe something like this:

Option Explicit
Sub testme()

Dim mySelectedSheets As Sheets
Dim iCtr As Long

Set mySelectedSheets = ActiveWindow.SelectedSheets

If mySelectedSheets.Count = 1 Then
Exit Sub
End If

mySelectedSheets(1).Select

For iCtr = 2 To mySelectedSheets.Count
ActiveWindow.NewWindow
mySelectedSheets(iCtr).Select
Next iCtr

ActiveWorkbook.Windows.Arrange ArrangeStyle:=xlHorizontal 'xlVertical

End Sub


(I found it easier to see the results using horizontal.)
 
Yes, I understood the question to be asking whether sheets could be arranged
vertically in the same window. If I misunderstood the question, then my
apologies.

Dave
 
Most excellent answer; I note that sheets get assigned in :3,:2,:1 order.
Any way to reverse to :1,:2,:3 order?
Thanks,
Jim
 
Maybe just go in reverse?

Option Explicit
Sub testme()

Dim mySelectedSheets As Sheets
Dim iCtr As Long

Set mySelectedSheets = ActiveWindow.SelectedSheets

If mySelectedSheets.Count = 1 Then
Exit Sub
End If

mySelectedSheets(mySelectedSheets.Count).Select

For iCtr = mySelectedSheets.Count - 1 To 1 Step -1
ActiveWindow.NewWindow
mySelectedSheets(iCtr).Select
Next iCtr

ActiveWorkbook.Windows.Arrange ArrangeStyle:=xlHorizontal 'xlVertical

End Sub
 
Fantastic, much appreciated Dave
Jim

Dave Peterson said:
Maybe just go in reverse?

Option Explicit
Sub testme()

Dim mySelectedSheets As Sheets
Dim iCtr As Long

Set mySelectedSheets = ActiveWindow.SelectedSheets

If mySelectedSheets.Count = 1 Then
Exit Sub
End If

mySelectedSheets(mySelectedSheets.Count).Select

For iCtr = mySelectedSheets.Count - 1 To 1 Step -1
ActiveWindow.NewWindow
mySelectedSheets(iCtr).Select
Next iCtr

ActiveWorkbook.Windows.Arrange ArrangeStyle:=xlHorizontal 'xlVertical

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top