Validation error

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
 
H

Hydra

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top