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

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
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,223,712
Messages
6,174,033
Members
452,542
Latest member
Bricklin

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