Validation error

  • Thread starter Thread starter Hydra
  • Start date Start date
H

Hydra

I'm trying to modify validation for adjacent celss on the fly depending on
the value of the previous cell. I've got this code but it is throwing an
error.

?????


If ActiveCell.Offset(0, -1).Value = "D" Then
'Range(Myaddress).Validation.Modify (xlValidateDate,
xlValidAlertInformation, _ xlBetween, ="1/1/2010", ="12/31/2020")

Endif
 
What I wound up with was:



If ActiveCell.Offset(0, -1).Value = "D" Then

With Range(Myaddress).Validation
.Delete
.Add Type:=xlValidateDate, _
AlertStyle:=xlValidAlertInformation, _
Operator:=xlBetween, _
Formula1:="1/1/2010", Formula2:="12/31/2020"
End With

Else

With Range(Myaddress).Offset(0, 1).Validation
.Delete
.Add Type:=xlValidateDate, _
AlertStyle:=xlValidAlertInformation, _
Operator:=xlBetween, _
Formula1:="1/1/2010", Formula2:="12/31/2020"
End With
 
Back
Top