SheetChange script throws Run Time error when clearing any cell

supercharger

New Member
Joined
Aug 14, 2017
Messages
13
I'm novice by all definitions with VBA, but I can usually piece things together that I need to do. this one is stumping me.

I have a cell, C62, that I have a data validation list with five options. Two options out of that, I want it to make additional rows, 65-68, visible.

The code works perfectly; if I clear any cell in the entire worksheet, I get a Run Time Error 13 dialog.

Any help is greatly appreciated!

Code:
Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
 
        If Target.Address = ("$C$62") And Target.Value2 = "Minimal with External/Contract Change Resource - Advisory and material review" Then
       Sheets("Change Needs Assessment").Rows("65:68").EntireRow.Hidden = False
       ElseIf Target.Address = ("$C$62") And Target.Value2 = "Moderate + - External/Contract Change Lead requested for change strategy and deliverable " Then
       Sheets("Change Needs Assessment").Rows("65:68").EntireRow.Hidden = False
        ElseIf Target.Address = ("$C$62") And Target.Value2 = "" Then
        Sheets("Change Needs Assessment").Rows("65:68").EntireRow.Hidden = True
        ElseIf Target.Address = ("$C$62") And Target.Value2 = "Minimal with Internal Strategic Change Resource- Advisory and material review" Then
        Sheets("Change Needs Assessment").Rows("65:68").EntireRow.Hidden = True
        ElseIf Target.Address = ("$C$62") And Target.Value2 = "Moderate + - Internal Change Lead requested for change strategy and deliverable " Then
        Sheets("Change Needs Assessment").Rows("65:68").EntireRow.Hidden = True
        ElseIf Target.Address = ("$C$62") And Target.Value2 = "None - The project does not believe Change Management is required" Then
        Sheets("Change Needs Assessment").Rows("65:68").EntireRow.Hidden = True
        
        End If
       
       
        
End Sub
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Forum statistics

Threads
1,224,823
Messages
6,181,185
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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