KaibleBasha
New Member
- Joined
- Aug 8, 2014
- Messages
- 36
Hi,
I found this piece of code from a reply by HalfAce (or MrExcel MVP).
Private Sub Worksheet_Calculate()
Dim LstRw As Long, Rw As Long
Application.ScreenUpdating = False
'''Define LstRw as the last row in column F with data.
LstRw = Cells(Rows.Count, "F").End(xlUp).Row
'''Un-hide all rows to start with
Range("F4:F" & LstRw).EntireRow.Hidden = False
''' Go through column F, (starting at row 4) _ & hide all rows with a value of 1
For Rw = 4 To LstRw
If Cells(Rw, "F") = 1 Then Cells(Rw, "F").EntireRow.Hidden = True
Next Rw
Application.ScreenUpdating = True
End Sub
I copied it & modified it slightly, only to to fit my report. So it looks like this;
Private Sub Worksheet_Calculate()
Dim LstRw As Long, Rw As Long
Application.ScreenUpdating = False
'''Define LstRw as the last row in column B with data.
LstRw = Cells(Rows.Count, "B").End(xlUp).Row
'''Un-hide all rows to start with
Range("B7:B" & LstRw).EntireRow.Hidden = False
''' Go through column B, (starting at row 7) & hide all rows with a value of 1
For Rw = 7 To LstRw
If Cells(Rw, "B") <> Cells(2, "I") Then Cells(Rw, "B").EntireRow.Hidden = True
Next Rw
Application.ScreenUpdating = True
End Sub
My question is how do I get his to unhide all rows after the value of "WorkersName" ("I2") is nothing e.g. I delete the workers name. As currently this will only unhide the rows up to the last row that is not hidden. E.g. I run this and rows 34,35,39 are not hidden, then I delete the worker name from I2. At this point, only 39 of the 100 rows are revealed.
Thanks & sorry I am a n00b.
Kai
I found this piece of code from a reply by HalfAce (or MrExcel MVP).
Private Sub Worksheet_Calculate()
Dim LstRw As Long, Rw As Long
Application.ScreenUpdating = False
'''Define LstRw as the last row in column F with data.
LstRw = Cells(Rows.Count, "F").End(xlUp).Row
'''Un-hide all rows to start with
Range("F4:F" & LstRw).EntireRow.Hidden = False
''' Go through column F, (starting at row 4) _ & hide all rows with a value of 1
For Rw = 4 To LstRw
If Cells(Rw, "F") = 1 Then Cells(Rw, "F").EntireRow.Hidden = True
Next Rw
Application.ScreenUpdating = True
End Sub
I copied it & modified it slightly, only to to fit my report. So it looks like this;
Private Sub Worksheet_Calculate()
Dim LstRw As Long, Rw As Long
Application.ScreenUpdating = False
'''Define LstRw as the last row in column B with data.
LstRw = Cells(Rows.Count, "B").End(xlUp).Row
'''Un-hide all rows to start with
Range("B7:B" & LstRw).EntireRow.Hidden = False
''' Go through column B, (starting at row 7) & hide all rows with a value of 1
For Rw = 7 To LstRw
If Cells(Rw, "B") <> Cells(2, "I") Then Cells(Rw, "B").EntireRow.Hidden = True
Next Rw
Application.ScreenUpdating = True
End Sub
My question is how do I get his to unhide all rows after the value of "WorkersName" ("I2") is nothing e.g. I delete the workers name. As currently this will only unhide the rows up to the last row that is not hidden. E.g. I run this and rows 34,35,39 are not hidden, then I delete the worker name from I2. At this point, only 39 of the 100 rows are revealed.
Thanks & sorry I am a n00b.
Kai
Last edited: