ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   worksheet_change (https://www.excelbanter.com/excel-programming/416313-worksheet_change.html)

makulski

worksheet_change
 
I have two drop down lists.
One in A2 and one in A4.
The list that supports A4 changes when A2 changes
What I want to happen is when A2 changes, A4 is set to blank (forcing the
user to make a new selection in A4 from the new list.

I've written this simple routine, but it doesn't work.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$2" Then
Range("$A$4").Value = ""
End If
End Sub

Nothing happens. I've done a breakpoint and stepped through it. It is being
triggered and correctly determines that A2 has changed. But the change to A4
does not happen.
I've tried a lot of variations, but nothing seems to allow me to get A4 to
change.

Orion Cochrane

worksheet_change
 
Are your drop-downs as a result of a ComboBox or a Data Validation rule?
--
Please rate posts so we know when we have answered your questions. Thanks.


"makulski" wrote:

I have two drop down lists.
One in A2 and one in A4.
The list that supports A4 changes when A2 changes
What I want to happen is when A2 changes, A4 is set to blank (forcing the
user to make a new selection in A4 from the new list.

I've written this simple routine, but it doesn't work.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$2" Then
Range("$A$4").Value = ""
End If
End Sub

Nothing happens. I've done a breakpoint and stepped through it. It is being
triggered and correctly determines that A2 has changed. But the change to A4
does not happen.
I've tried a lot of variations, but nothing seems to allow me to get A4 to
change.


makulski

worksheet_change
 
They are data validation rules.

"Orion Cochrane" wrote:

Are your drop-downs as a result of a ComboBox or a Data Validation rule?



TomPl

worksheet_change
 
1. Make sure the validation rule for A4 allows a blank value.
2. Make sure the code is in the worksheet, not in a module.

Tom

"makulski" wrote:

They are data validation rules.

"Orion Cochrane" wrote:

Are your drop-downs as a result of a ComboBox or a Data Validation rule?



makulski

worksheet_change
 
Thanks for the suggestions.

I believe I had both set that way.
But, this morning it is working!
So, I'll credit you with a win.


"TomPl" wrote:

1. Make sure the validation rule for A4 allows a blank value.
2. Make sure the code is in the worksheet, not in a module.

Tom



All times are GMT +1. The time now is 01:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com