Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Code to tile windows horizontally

  Asked By: Hondo    Date: Oct 03    Category: MS Office    Views: 1000
  

Hoping someone can help. Tried to research but can't find anything.
Here's the scenario: users in Sheet1 click on a radio button that
takes them to Sheet2 (in same workbook). When that happens, I want to
horizontally tile the 2 worksheets (Sheet1 and Sheet2). When the user
clicks anywhere on Sheet1, Sheet1 window maximizes (no more tiling).

Share: 

 

3 Answers Found

 
Answer #1    Answered By: Maurice Hanson     Answered On: Oct 03

This is from the macro recorder.

With ActiveWindow
.Width = 274.5
.Height = 352.5
End With
ActiveWindow.NewWindow
With ActiveWindow
.Top = 118.75
.Left = 1.75
End With
Sheets("Sheet2").Select
ActiveWorkbook.Windows.Arrange ArrangeStyle:=xlHorizontal

First I resized the active window  with the mouse.
Then I opened a new window. Window/New Window
Next I resized that one.
Finally I set the windows  to horizontal tiling.

 
Answer #2    Answered By: Bellona Lopez     Answered On: Oct 03


This seems to work:

Place the following code  in the "ThisWorkbook" module:

Private Sub Workbook_WindowActivate(ByVal Wn As Window)
MyName = ThisWorkbook.Name
Win1 = MyName & ":1"
Win2 = MyName & ":2"
If Wn.Caption = Win1 Then
Wn.WindowState = xlMaximized
Windows(Win2).Close
End If
End Sub

Then place the following code in a standard module e.g. "Module1":

Sub Button1_Click()
ActiveWindow.NewWindow
Windows.Arrange ArrangeStyle:=xlHorizontal
MyName = ThisWorkbook.Name
Win1 = MyName & ":1"
Win2 = MyName & ":2"
Windows(Win2).Activate
Sheets("Sheet2").Select
End Sub

Next, place a button  on Sheet1 and have the button call the above
macro.

Let me know if this is what you are loking for.

 
Answer #3    Answered By: Jonathan Harrison     Answered On: Oct 03

Absolutely what I was looking for - it works
perfectly. Thank you so very much, I can't tell you
how much I appreciate it.

 
Didn't find what you were looking for? Find more on Code to tile windows horizontally Or get search suggestion and latest updates.




Tagged: