stmorrison
New Member
- Joined
- Nov 1, 2010
- Messages
- 1
I have limited knowledge of VBA, but have determined it is needed to automate row hiding in my workbook with mulitple worksheets. I need help desparately! Here is what I need to accomplish:
On Worksheet 1, if I have a 0 or blank in cell C11, I need to hide rows 7, 14, and 21 of Worksheet 2.
Or on Worksheet 1, if I have a 0 or blank in cell C12, I need to hide rows 8, 15, and 22 of Worksheet 2.
Or - I will continue to insert other criteria too.
Worksheet 2 is being used to generate charts on Worksheet 3. Therefore based on certain criteria I am trying to automatically hide rows on worksheet 2 to eliminate gaps in my charts.
For what it is worth, I have tried the below VBA in worksheet 1. The first part works - this code will hide rows 8, 15, and 22 based on C12 input but I can't get other parts of the code to function.
If Target <> Range("C12") Then Exit Sub
Sheets("At A Glance").Rows.Hidden = False
Select Case Range("C12").Value
Case 0
Sheets("At A Glance").Rows("8").Hidden = True
Sheets("At A Glance").Rows("15").Hidden = True
Sheets("At A Glance").Rows("22").Hidden = True
or_
If Target <> Range("C11") Then Exit Sub
Sheets("At A Glance").Rows.Hidden = False
Select Case Range("C11").Value
Case 0
Sheets("At A Glance").Rows("7").Hidden = True
Sheets("At A Glance").Rows("14").Hidden = True
Sheets("At A Glance").Rows("21").Hidden = True
End Sub
On Worksheet 1, if I have a 0 or blank in cell C11, I need to hide rows 7, 14, and 21 of Worksheet 2.
Or on Worksheet 1, if I have a 0 or blank in cell C12, I need to hide rows 8, 15, and 22 of Worksheet 2.
Or - I will continue to insert other criteria too.
Worksheet 2 is being used to generate charts on Worksheet 3. Therefore based on certain criteria I am trying to automatically hide rows on worksheet 2 to eliminate gaps in my charts.
For what it is worth, I have tried the below VBA in worksheet 1. The first part works - this code will hide rows 8, 15, and 22 based on C12 input but I can't get other parts of the code to function.
If Target <> Range("C12") Then Exit Sub
Sheets("At A Glance").Rows.Hidden = False
Select Case Range("C12").Value
Case 0
Sheets("At A Glance").Rows("8").Hidden = True
Sheets("At A Glance").Rows("15").Hidden = True
Sheets("At A Glance").Rows("22").Hidden = True
or_
If Target <> Range("C11") Then Exit Sub
Sheets("At A Glance").Rows.Hidden = False
Select Case Range("C11").Value
Case 0
Sheets("At A Glance").Rows("7").Hidden = True
Sheets("At A Glance").Rows("14").Hidden = True
Sheets("At A Glance").Rows("21").Hidden = True
End Sub