Help with Private Sub Worksheet_Change(ByVal Target As Range)

aashish83

Board Regular
Joined
Feb 15, 2022
Messages
62
Office Version
  1. 365
Platform
  1. Windows
Need help with the below code

Case C18 - runs a macro to hide certain rows basis input Yes or No

Case F33 - Fills all blank cells in the range with Yes or No or Blank

Now when i run Case F33 all the hidden rows under Case C18 become unhidden even if the input on C18 is Yes


Private Sub Worksheet_Change(ByVal Target As Range)

If Target.CountLarge > 1 Then Exit Sub

If Not Intersect(Target, Range("C18:C19,F33,F8,F9")) Is Nothing Then
Select Case Target.Address(0, 0)

Case "C18"
If Target.Value = "Yes" Then
Call Cenb
ElseIf Target.Value = "No" Then
Call Cenb1
End If
Case "C19"
If Target.Value = "Yes" Then
Call CyberB
ElseIf Target.Value = "No" Then
Call CyberB1
End If
Case "F33"
If Target.Value = "Yes_to_All" Then
Call Yes_to_All_B
ElseIf Target.Value = "No_to_All" Then
Call No_to_All_B
ElseIf Target.Value = "Blank_to_All" Then
Call Blank_to_All_B
End If
Case "F8"
If Target.Value = "Yes" Then
Call Report_PrintB
End If
Case "F9"
If Target.Value = "Yes" Then
Call GeneratePDFB
End If
End Select
End If

End Sub
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Your issue is to be found in one of the three macros you are 'Call'ing in Case F33, not in this 'Worksheet_Change'
 
Upvote 0
Your issue is to be found in one of the three macros you are 'Call'ing in Case F33, not in this 'Worksheet_Change'
I will have a relook at the code of the 3 macros or post them for suggestions but I was using the same macro in a workbook module but it did not interfere with it earlier but now since i have moved it to worksheet change it is unhiding the rows in case C18.
 
Upvote 0

Forum statistics

Threads
1,214,892
Messages
6,122,112
Members
449,066
Latest member
Andyg666

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top