Hi
I'm new to VBA so apologies if this is a silly question.
I found a useful bit of code that, upon opening the workbook, hides rows on a sheet when they contain no info:
Private Sub Workbook_Open()
Dim myRng As Range
Dim myCell As Range
With Worksheets("League Table")
Set myRng = .Range("B3:B83")
For Each myCell In myRng.Cells
myCell.EntireRow.Hidden = CBool(myCell.Value = "")
Next myCell
End With
End Sub
I also need to apply this to another sheet in the same workbook when the cells contain 0 values but (and here comes the potentially stupid question) I'm not sure how to add that bit of code to the existing bit. The extra bit on its own would look like this:
Private Sub Workbook_Open()
Dim myCell As Range
With Worksheets("Team Summaries")
Set myRng = .Range("B14:B34")
For Each myCell In myRng.Cells
myCell.EntireRow.Hidden = CBool(myCell.Value = "0")
Next myCell
End With
End Sub
How can I make this one macro that will run upon opening?
Appreciate any help anyone can give me!
Thanks
I'm new to VBA so apologies if this is a silly question.
I found a useful bit of code that, upon opening the workbook, hides rows on a sheet when they contain no info:
Private Sub Workbook_Open()
Dim myRng As Range
Dim myCell As Range
With Worksheets("League Table")
Set myRng = .Range("B3:B83")
For Each myCell In myRng.Cells
myCell.EntireRow.Hidden = CBool(myCell.Value = "")
Next myCell
End With
End Sub
I also need to apply this to another sheet in the same workbook when the cells contain 0 values but (and here comes the potentially stupid question) I'm not sure how to add that bit of code to the existing bit. The extra bit on its own would look like this:
Private Sub Workbook_Open()
Dim myCell As Range
With Worksheets("Team Summaries")
Set myRng = .Range("B14:B34")
For Each myCell In myRng.Cells
myCell.EntireRow.Hidden = CBool(myCell.Value = "0")
Next myCell
End With
End Sub
How can I make this one macro that will run upon opening?
Appreciate any help anyone can give me!
Thanks