how do I freeze the window with VBA?
These rows/columns need to be hidden because this workbook is being sent to a
novice user of Excel who is apparently confused by extraneous data. Hiding
the sheet is irrelevant here. Only a portion of it needs to be hidden.
Dave
--
Brevity is the soul of wit.
"pgchop" wrote:
ok.
maybe the first question sould be why do you want to hide these columns.
Because you can easily make your calculations on an other sheet and hide the
entire sheet, even with a passord and even "veryhide" the sheet so that the
sheet can not be "unhidden" manually but only using vba...
Sub VeryHideSheet()
Sheets("secret").Visible = xlSheetVeryHidden
End Sub
Sub ShowSheet()
Sheets("secret").Visible = xlSheetVisible
End Sub
"Dave F" wrote:
Sorry, let me be a little more specific. I recorded a macro, which I
intended to do the following three things:
1) Hide rows 86:120
2) Hide columns AM:CP
3) Freeze the windo at cell J4
This resulted in the following code:
Sub ShowTCAPSfcst()
'
' ShowTCAPSfcst Macro
' Macro recorded 11/17/2006 by df78700
'
' Hides rows 85:120, hides columns AM:CP, and freezes window at J4
Rows("85:120").Select
Selection.EntireRow.Hidden = True
Columns("AM:CP").Select
Selection.EntireColumn.Hidden = True
Range("J4").Select
ActiveWindow.FreezePanes = True
End Sub
I attached this code to a button and started to test it. I noticed that the
frozen cell wouldn't stay at J4. So, is there better code to use, than that
provided by Excel's default macro recorder?
Thanks,
Dave
--
Brevity is the soul of wit.
"pgchop" wrote:
Application.ScreenUpdating = False
is what you are looking for ?
"Dave F" wrote:
--
Brevity is the soul of wit.
|