Dan Swartz
Board Regular
- Joined
- Apr 17, 2020
- Messages
- 53
- Office Version
- 365
- Platform
- Windows
Hi, I'm new here. I have asked this on several other forms and I have not received an answer. I'm also not sure how to ask this as it's pretty complicated. I'll try and keep it on the vague side. I'll upload an image.
The setup:
1. I use conditional formatting using MOD(ROW(),2)=0 to alternate color of cells from B7 to M99.
2. I have a list of questions in column A with Answers in column B and more information in the following columns. If the answer in Column B is "None", then I automatically want to hide that row. Also, "None" Is selected from a dropdown and so if I accidentally select none, then I need to manually be able to unhide the row so I can change the value to the proper value.
What I have right now it working, but I have 3 issues.
Issue 1. When a row is hidden, I no longer have alternating colors on my rows.
Issue 2. If I do multiple selections and delete, or insert a row or do any editing on more then one cell. I get the "Run TIme Error 13 - Type Mismatch"
Issue 3. I have a formula, where if one value says none, then i'm turning the following 6 lines to None, but it won't hide those rows unless I double click in the cell and hit enter.
I hope this is clear enough to get answers.
Here is my code.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim MyRange, N As Range
Set MyRange = Range("B8:B90")
If Not Application.Intersect(Target, MyRange) Is Nothing Then
If Target.Value = "N/A" Then
Target.EntireRow.Hidden = True
Else
Target.EntireRow.Hidden = False
End If
End If
End Sub
The setup:
1. I use conditional formatting using MOD(ROW(),2)=0 to alternate color of cells from B7 to M99.
2. I have a list of questions in column A with Answers in column B and more information in the following columns. If the answer in Column B is "None", then I automatically want to hide that row. Also, "None" Is selected from a dropdown and so if I accidentally select none, then I need to manually be able to unhide the row so I can change the value to the proper value.
What I have right now it working, but I have 3 issues.
Issue 1. When a row is hidden, I no longer have alternating colors on my rows.
Issue 2. If I do multiple selections and delete, or insert a row or do any editing on more then one cell. I get the "Run TIme Error 13 - Type Mismatch"
Issue 3. I have a formula, where if one value says none, then i'm turning the following 6 lines to None, but it won't hide those rows unless I double click in the cell and hit enter.
I hope this is clear enough to get answers.
Here is my code.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim MyRange, N As Range
Set MyRange = Range("B8:B90")
If Not Application.Intersect(Target, MyRange) Is Nothing Then
If Target.Value = "N/A" Then
Target.EntireRow.Hidden = True
Else
Target.EntireRow.Hidden = False
End If
End If
End Sub