Option
Explicit
Private
Sub
Worksheet_Change(
ByVal
Target
As
Range)
Application.EnableEvents =
False
On
Error
GoTo
ErrHandler
Dim
rngRef
As
Excel.Range
Dim
rngArea
As
Excel.Range
Dim
rngCells
As
Excel.Range
Dim
rngCell
As
Excel.Range
Set
rngRef = ActiveSheet.UsedRange.Columns
Select
Case
rngRef
Case
Is
=
"C"
Set
rngCells = Intersect(Target, rngRef)
If
Not
rngCells
Is
Nothing
Then
For
Each
rngArea
In
rngCells.Areas
For
Each
rngCell
In
rngArea.Cells
With
Cells(rngCell.row,
"D"
)
If
Trim$(rngCell.Value) <>
""
Then
Call
.Validation.Delete
Call
.ClearContents
Call
.Validation.Add(xlValidateList, Formula1:=
"=Drivers"
)
Else
Call
.Validation.Delete
Call
.ClearContents
End
If
End
With
Next
Next
End
If