redbaron06
New Member
- Joined
- Aug 6, 2010
- Messages
- 44
Hi Everyone!
I would really appreciate some help with this one.
I am trying to hide a worksheet using the old value in a cell and then unhide another worksheet using new value in the cell. I want this event to be triggered by a change in cell "O11" (generated from a formula). I have tried a few different methods and have run into a roadblock. I cannot figure out how to save the previous value of the cell before the change to use later in the Sub.
Thanks in advance! - Terry
Private Sub Worksheet_Calculate()
Static OldVal1 As Variant, OldVal2 As Variant
If Range("O11").Value <> OldVal1 Then
With Worksheets(OldVal1)Visible
.Visible = xlSheetVeryHidden
End With
OldVal1 = Range("O11").Value
Call PlayTennis
With Worksheets(Range("O11").Value)
.Visible = xlSheetVisible
End With
End If
End Sub
I would really appreciate some help with this one.
I am trying to hide a worksheet using the old value in a cell and then unhide another worksheet using new value in the cell. I want this event to be triggered by a change in cell "O11" (generated from a formula). I have tried a few different methods and have run into a roadblock. I cannot figure out how to save the previous value of the cell before the change to use later in the Sub.
Thanks in advance! - Terry
Private Sub Worksheet_Calculate()
Static OldVal1 As Variant, OldVal2 As Variant
If Range("O11").Value <> OldVal1 Then
With Worksheets(OldVal1)Visible
.Visible = xlSheetVeryHidden
End With
OldVal1 = Range("O11").Value
Call PlayTennis
With Worksheets(Range("O11").Value)
.Visible = xlSheetVisible
End With
End If
End Sub