• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Using Form Control Button & Freeze panes keep shifting on worksheet

sschwant

New Member
I have multiple Form Control buttons used to navigate to other locations on a ws which would otherwise require a lot of scrolling and/or paging up/down.
At the top section I have several buttons labeled Go To and then in the target areas I have buttons labeled Go Home to return to range "A1".
Here's the code from one of the buttons:

Sub GoTo_IncomeStmtConsol()
Application.ScreenUpdating = True
Application.Goto Reference:="Income_Stmt_Consol"
ActiveWindow.SmallScroll Down:=30
ActiveWindow.FreezePanes = True
End Sub​

And one other button:
Sub GoTo_RebateTables()
Application.ScreenUpdating = True
Application.Goto Reference:="RebateTables"
ActiveWindow.SmallScroll Down:=30
ActiveWindow.ScrollColumn = 22
ActiveWindow.FreezePanes = True
End Sub​

What I don't understand is sometimes this works just fine. The macro runs, goes to the designated named range, which in this case is "Income_Stmt_Consol" which also happens to be cell C91 ... and the panes freeze around the range with both vertical and horizontal panes as you'd expect w/ C91 in the top left corner. However, at the moment it's just locking panes horizontally at row 109.
Puzzling.
Any one have an explanation or solution to this problem - which does seem to be intermittent as well - one day it's working fine, the next day, it's off.
TIA for any insight!!
Steve
 
Without seeing your file, are any of the cells in that area Merged or part of Pivot tables, Charts or some other object that is connecting those cells ?
 
Without seeing your file, are any of the cells in that area Merged or part of Pivot tables, Charts or some other object that is connecting those cells ?

Hui,

Thanks for responding to my post. There is one section of the ws where there are two single variable Data Tables (they have 3 columns) and at the top of each is a title in a cell merged across the 3 columns. Though I don't think that's the culprit. I also have a "Go Home" form control button in each section so the user can quickly navigate back to the top left (A1) of the worksheet - in each case of the Go Home button, the macro first Unfreezes the panes and then executes the select/go-to range (a1). The reason I don't think the data tables merged cells are the problem is b/c the same issue is occurring else where on the ws where there are no other merged cells, charts or other ....

Of course there are formulas/links connecting all the various sections ....

Thanks again,

Steve
 
think I got the solution ... thanks to SamT on vbaexpress!!!
Sub GoTo_IncomeStmtConsol()
'
Application.ScreenUpdating = True
ActiveWindow.FreezePanes = False
Application.Goto Reference:=("Income_Stmt_Consol"), Scroll:=True
Range("Income_Stmt_Consol").Cells(2, 2).Activate
ActiveWindow.FreezePanes = True
End Sub
Sub GoTo_RebateTablesConsol()
'
Application.ScreenUpdating = True
ActiveWindow.FreezePanes = False
Application.Goto Reference:=("RebateTablesConsol"), Scroll:=True
ActiveWindow.ScrollColumn = 22
Range("RebateTablesConsol").Cells(2, 1).Activate
ActiveWindow.FreezePanes = True
had to adjust the placement of my named range in the first sub - but this now works ...
Regards,
Steve
 
Back
Top