VBA to hide a row in different worksheet
for the row to automatically get hidden a Worksheet change Event need to be
added into the code. Install as follows
1) right click tab on bottom of worksheet labeled Sheet1.
2) Select view Code
3) Copy subroutine below and paste into VBA Code window.
Sub Worksheet_Change(ByVal Target As Range)
If (Target.Row = 1) And (Target.Column = 1) And _
(Target = 0) Then
Worksheets("sheet2").Rows(5).EntireRow.Hidden = True
Else
Worksheets("sheet2").Rows(5).EntireRow.Hidden = False
End If
End Sub
"TDC" wrote:
I need a VBA code to automatically hide or unhide a row in one sheet based
upon the value is a cell on another sheet.
Example:
If Sheet1, cell A1 = 0, then Sheet2, row 5 is hiden.
If Sheet1, cell A1 0, then Sheet2, row 5 is visible.
Suggestions?
|