vba event

D

Daniel P

Hello

I've created a cell that has a validation list associated to it. Which Event can I use so that it will run that event when and only when that validation range is modified

Currently I've have the macro in the sheet_change section but this mean that it run whenever any change occurs on the sheet and this is useless. I only need it to run if the selection from the validation range change

Thank you for your help

Daniel
 
F

Frank Kabel

Hi Daniel
use the worksheet change event and restrict the range it should
process. e.g.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Me.Range("A1:A10")) Is Nothing Then Exit Sub
'your code

End Sub

your code is only processed if a single cell in the range A1:A10 is
changed
 
J

Jim Rech

If Target.Cells.Count > 1 Then Exit Sub

So, Frank, if the user selects 2 or more cells in the validation range and
makes a (Ctrl-Enter) change the validation routine is bypassed?<g>
 
F

Frank Kabel

Hi Jim
yes, as I wrote :)
....if a SINGLE cell in ....

But you're right the OP should probably delete this line
 
Top