Hi,
I've been searching to find a solution for my problem for about a week now. Can you please help me on this.
I've a vba code to hide a number of rows based on a selection (Yes or No) in a cell. I've another code to add rows in a table above those rows. Every time a row is added in a table, the range to hide rows has to change. Can it be made dynamic? I'm a novice at vba so please help.
Code to Hide rows is:
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("B13").Value = "No" Then
With Sheets("Main Sheet")
.Rows("32:40").EntireRow.Hidden = True
End With
End If
If Range("B13").Value = "Yes" Then
With Sheets("Main Sheet")
.Rows("32:40").EntireRow.Hidden = False
End With
End If
Need to update the bold reference automatically.
Need to submit my report tomorrow so very anxious for your response.
Thanks in advance
Umair
I've been searching to find a solution for my problem for about a week now. Can you please help me on this.
I've a vba code to hide a number of rows based on a selection (Yes or No) in a cell. I've another code to add rows in a table above those rows. Every time a row is added in a table, the range to hide rows has to change. Can it be made dynamic? I'm a novice at vba so please help.
Code to Hide rows is:
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("B13").Value = "No" Then
With Sheets("Main Sheet")
.Rows("32:40").EntireRow.Hidden = True
End With
End If
If Range("B13").Value = "Yes" Then
With Sheets("Main Sheet")
.Rows("32:40").EntireRow.Hidden = False
End With
End If
Need to update the bold reference automatically.
Need to submit my report tomorrow so very anxious for your response.
Thanks in advance
Umair