run time error only on drop down list columns

vze

New Member
Joined
Apr 7, 2022
Messages
9
Office Version
  1. 365
Platform
  1. Windows
I have several columns in this excel sheet with 2 being drop down lists.
Root cause column is a drop down
Sub root cause is a dependent drop down list (to the value selected in root cause)

While testing the excel, I found if I select the values in root cause/sub root cause and hit delete I get a run time error.
I want to be able to clear the values like this as a user may want to mass select rows and clear.

See attached example and code
 

Attachments

  • new code.png
    new code.png
    35.5 KB · Views: 4
  • new issue.png
    new issue.png
    89.8 KB · Views: 4

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
I have several columns in this excel sheet with 2 being drop down lists.
Root cause column is a drop down
Sub root cause is a dependent drop down list (to the value selected in root cause)

While testing the excel, I found if I select the values in root cause/sub root cause and hit delete I get a run time error.
I want to be able to clear the values like this as a user may want to mass select rows and clear.

See attached example and code
Code is :
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Column = 9 Then
If Target.Validation.Type = 3 Then
Target.Offset(0, 1).Value = ""
End If
End If

If Target.Column = 9 Then
If Target.Value = "" Then
Target.Offset(0, 1).Value = ""
End If
End If
Application.EnableEvents = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,460
Messages
6,124,949
Members
449,198
Latest member
MhammadishaqKhan

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