Excel VBA - Automatic adjusting of 2 windows

  • Thread starter Thread starter Geo Siggy
  • Start date Start date
G

Geo Siggy

My Excel application is splitted into two horizontal windows (not
panes), the one above is a diagram with fixed size in height. The one
below is a normal calculation sheet. The problem is how to program in
VBA, that the window below always will fill the remaining space of the
Excel spreadsheet (the remaining space is depending of the monitor,
resolution, the chosen toolbars etc).

Thanx Siggy
 
one way:

Const nWINDOW1HEIGHT = 300 'change to suit
If Windows.Count <> 2 Then Exit Sub
With Windows(1)
.Top = 0
.Width = Application.UsableWidth
.Height = nWINDOW1HEIGHT
End With
With Windows(2)
.Top = nWINDOW1HEIGHT + 1
.Width = Application.UsableWidth
.Height = Application.UsableHeight - nWINDOW1HEIGHT
End With
 

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