Selecting a range after activating a worksheet
The initial macro is being called from an option button. when I created the
macro, it put it on the excel object for sheet1. I was trying to activate
sheet2 and hide columns on sheet2 from here. When I put the piece of the
macro to hide the columns for sheet2 in a module instead, it worked. I end
up with two macros instead of one, as shown below. I'm sure there's probably
a better way to do things, but I'm not that familiar with programming in
Excel.
Private Sub opt1_Click()
If Opt1 = True Then
ActiveSheet.Unprotect
Range("SampleStrat").EntireRow.Hidden = False
Range("UnstratSample").EntireRow.Hidden = True
Application.Run ("Module1.HideUnstrat")
End If
End Sub
Sub HideStrat()
Sheets("Sample Evaluation").Select
ActiveSheet.Unprotect
Columns("B:D").Select
Selection.EntireColumn.Hidden = True
Columns("E:E").Select
Selection.EntireColumn.Hidden = False
ActiveSheet.Protect Contents:=True, Scenarios:=True,
AllowFormattingCells:=True
Worksheets("Sample Calc").Select
ActiveSheet.Protect Contents:=True, Scenarios:=True,
AllowFormattingCells:=True
End Sub
--
JP
"Conan Kelly" wrote:
JPCPA,
Just out of curiosity, what was your error.
I briefly looked at your post to see if I could figure it out.
Thanks,
Conan
"JPCPA" wrote in message
...
Never mind! I figured out my error.
--
JP
|