Data Validation

tasander

Board Regular
Joined
Mar 6, 2009
Messages
67
Hi

I have 3 colums all with list data validation, the last 2 columns have lists that change depending on what is selected in the first column.

This works fien however if a user selects something on either of the final 2 columns but then goes and changes their input on the first column the final 2 colums stay the same even though the validation list has changed and their original entry is not a valid selection.

I am wondering if there is a way to get the validation boxes to refresh every time column 1 is changed/selected?

Any ideas

Thanks
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Yes. You need to capture the change in the first cell and then empty the 2nd cell.

To capture a change you need to write a macro in the sheet module. To do this, right click on the sheet tab and select 'View Code'.
The macro editor will open.
Let's assume that your first column is column A
The code will first test to see if the changed cell is in column A.
Then it will empty the cells in B and C with the same row number

Copy the following code to the macro editor:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("A:A")) Is Nothing Then
        Target.Offset(0, 1).Clear
        Target.Offset(0, 2).Clear
    End If
End Sub
 
Upvote 0
I think that sijpie's idea to use the Worksheet_Change event to capture this but I didn't think you wanted to clear the cells. I'd use:-

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A:A")) Is Nothing Then
Cells(Target.Row, Target.Column + 1).Calculate
Cells(Target.Row, Target.Column + 2).Calculate
End If
End Sub

Cheers
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,173
Members
451,543
Latest member
cesymcox

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