Hiding/Unhiding sheets and rows (An easy one for most of you....)
add this to the code for sheet1.make sure that you have a worksheet called
sheet2
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
If Target.Value = 0 Then
SheetHide "Sheet2"
Else
SheetUnhide "Sheet2"
End If
End If
End Sub
Sub SheetHide(sheetname As String)
Worksheets(sheetname).Visible = False
End Sub
Sub SheetUnhide(sheetname As String)
Worksheets(sheetname).Visible = True
End Sub
type 0 (zero) into A1 of sheet1 and sheet2 will be hidden. type anything
else into A1 of sheet1 and sheet2 will be visible
TIP: Use the macro-recorder & examine the code - it will be a big help.
Usually the code will need to be tweaked to get it just so though.
HTH
Patrick Molloy
Microsoft Excel MVP
"Dean Goodmen" wrote:
I have three sheets in my workbook and under certain circumstance I
need to hide/unhide and entire sheet, or just certain rows. Could some
one give me an example on how to code a line to do this?
Thanks!
|