PDA

View Full Version : Change Application width of active worksheet focus



cliffwms
02-26-2010, 12:18 PM
I am trying to set up my worksheets so that when a specific sheet becomes the active sheet the application width is changed to a specifc setting. I am trying:

Sub ChangeMID_DAYReportWidth()
Dim worksheet1 As Excel.Worksheet = _
CType(Me.ActiveSheet, Excel.Worksheet)
Application.Width = 600
Application.Height = 825
End Sub

but it's not working

mbarron
02-26-2010, 12:40 PM
Try something like this:

With Application
.WindowState = xlNormal
.Width = 600
.Height = 825
End With

cliffwms
03-03-2010, 09:20 AM
what I am trying to do is come up with some VBA code that will change the (excel) application width to fit the active sheet. When it gets "the focus"!

I have my worksheets set up so when they open they are adjusted to the correct (application) width. However, when I close the "top" worksheet, I would like excel to adjust the application width to fit the sheet that then becomes active ( or the one "on top")....