Code: Select all
Sheets.Add(After:=Sheets("anExisitingSheet")).Name = "newSheet"
Code: Select all
With ActiveWindow
.Zoom = 90
.SplitColumn = 0
.SplitRow = 1
.FreezePanes = True
End With
Thanks,
Ken
Code: Select all
Sheets.Add(After:=Sheets("anExisitingSheet")).Name = "newSheet"
Code: Select all
With ActiveWindow
.Zoom = 90
.SplitColumn = 0
.SplitRow = 1
.FreezePanes = True
End With
When I glanced at this I nearly spilled my coffee on The Desktop.
Code: Select all
With Worksheets("newSheet")
.Zoom = 90
.SplitColumn = 0
.SplitRow = 1
.FreezePanes = True
End With
Stuart, you are an Olympic-sized swimming-pool, based on how quickly you can make me get out of my depth!
Thanks Stuart. I can do almost as well in Excel2003 by choosing Window, Split, although in my case a Zoom factor applies to both panes because I do not have two separate Window objects here (as per Hans's explanation).
Nether could Ken but no matter what variation on that sort of syntax he tried, Excel VBA gave errors. That's why Ken asked here. Now Ken knows a bit more about Excel's object model and Ken is happyChrisGreaves wrote: ↑20 Sep 2021, 12:00...I can't think of a reason why Ken shouldn't be able to codeCode: Select all
With Worksheets("newSheet") .Zoom = 90 .SplitColumn = 0 .SplitRow = 1 .FreezePanes = True End With
Thanks Hans; I see that now. In my Excel2003 I do not have View, new Window, which is why I stopped when I got to Window, Split, but I missed seeing Window, New, my eye gravitating to the familiar “split”. I have since tried with Window New and now see what Stuart sees.What Stuart says - you can open multiple windows in a workbook by selecting View > New Window. You can see that there are multiple windows in the title bar:
Right Ken! Excel VBA errors because Excel doesn’t support it. My “I don’t see why” was aimed petulantly at “Why wasn’t Excel designed to work this way?”. I had not written clearly.Neither could Ken but no matter what variation on that sort of syntax he tried, Excel VBA gave errors. That's why Ken asked here. Now Ken knows a bit more about Excel's object model and Ken is happy
Stuart I can’t think of a better reason for hanging around in Eileen’s Lounge!It's good to be happy