Dave,
I assume that you mean why is the whole sheet remaining selected because if
you run:
Sub ProjectSummary()
'Hides rows 4:94
'Freeze window at E97
Cells.Select
MsgBox "Dave"
Range("B1").Activate
Selection.EntireRow.Hidden = False
Selection.EntireColumn.Hidden = False
Rows("4:94").Select
Selection.EntireRow.Hidden = True
Range("E73").Select
ActiveWindow.FreezePanes = False
ActiveWindow.FreezePanes = True
End Sub
You will see that the whole sheet is being selected. The differencebetween
the macros is that in this one you later make another selection and that is
Rows("4:94").Select But why Select them in the first place? Try it with
the Cells.Select line removed.
As others have said in the NG's selecting slows up macros and it is seldom
necessary to select object before carying out operations on them.
Sub ProjectSummary()
'Hides rows 4:94
'Freeze windowCells.Select
With Range("B1")
.EntireRow.Hidden = False
.EntireColumn.Hidden = False
End With
With Rows("4:94")
.EntireRow.Hidden = True
End With
Range("E73").Activate
ActiveWindow.FreezePanes = False
ActiveWindow.FreezePanes = True
End Sub
More programming but they tell me that it runs faster
Incidentally why activate a cell in the hidden range?
--
HTH
Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings
(e-mail address removed)
(e-mail address removed) with @tiscali.co.uk
Dave F said:
Well that would be the obvious answer. However, when I run a different
macro, the entire worksheet is not selected:
Sub ProjectSummary()
'Hides rows 4:94
'Freeze window at E97
Cells.Select
Range("B1").Activate
Selection.EntireRow.Hidden = False
Selection.EntireColumn.Hidden = False
Rows("4:94").Select
Selection.EntireRow.Hidden = True
Range("E73").Select
ActiveWindow.FreezePanes = False
ActiveWindow.FreezePanes = True
End Sub
So I'm not sure Cells.Select is the issue.