ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Modify Data Validation Input Message (https://www.excelbanter.com/excel-programming/408404-modify-data-validation-input-message.html)

tony[_4_]

Modify Data Validation Input Message
 
Hi,

I'm a bit stuck with the above, I can use the Modify method to change
the data validation criteria for a given range as in the code below:

With Selection.Validation
.Modify Type:=xlValidateList, AlertStyle:=xlValidAlertStop,
Operator _
:=xlBetween, Formula1:="=$S$3:$S$4"
.ErrorTitle = "Invalid Entry"
.ErrorMessage = "Enter Yes or No."
End With

However try as I might I cannot change the the actual title and
message displayed when the cell is entered. I need to keep the
validation criteria exactly as set and I think this is where I'm
coming unstuck. I have tried the following code but this just gives me
an error.

With Selection.Validation
.Modify
.InputTitle = myTitle
.InputMessage = myMessage
End With

Any help gratefully received.

Thanks

Nigel[_2_]

Modify Data Validation Input Message
 
I think you need to delete the validation first then reset it.

With Range("B3").Validation
.Delete
.Add ..........etc

End With

--

Regards,
Nigel




"tony" wrote in message
...
Hi,

I'm a bit stuck with the above, I can use the Modify method to change
the data validation criteria for a given range as in the code below:

With Selection.Validation
.Modify Type:=xlValidateList, AlertStyle:=xlValidAlertStop,
Operator _
:=xlBetween, Formula1:="=$S$3:$S$4"
.ErrorTitle = "Invalid Entry"
.ErrorMessage = "Enter Yes or No."
End With

However try as I might I cannot change the the actual title and
message displayed when the cell is entered. I need to keep the
validation criteria exactly as set and I think this is where I'm
coming unstuck. I have tried the following code but this just gives me
an error.

With Selection.Validation
.Modify
.InputTitle = myTitle
.InputMessage = myMessage
End With

Any help gratefully received.

Thanks



tony[_4_]

Modify Data Validation Input Message
 
Thanks Nigel,

I've done that but in doing so I have to re-write the validation
criteria to all the cells.

The thing is the InputText and InputMessage are the same for the whole
row, it's just the validation criteria that changes by column.

In some cases I may have 19 columns and upto 8000 rows to write so you
can understand that a change of the Input criteria would be a far
simpler option.

Thanks

Tony

Nigel[_2_]

Modify Data Validation Input Message
 
With a bit of experimenting, it seems this works......

With Selection.Validation
.InputTitle = myTitle
.InputMessage = myMessage
End With

--

Regards,
Nigel




"tony" wrote in message
...
Thanks Nigel,

I've done that but in doing so I have to re-write the validation
criteria to all the cells.

The thing is the InputText and InputMessage are the same for the whole
row, it's just the validation criteria that changes by column.

In some cases I may have 19 columns and upto 8000 rows to write so you
can understand that a change of the Input criteria would be a far
simpler option.

Thanks

Tony



tony[_4_]

Modify Data Validation Input Message
 
Cheers Nigel,

No joy there either, I get the run time error 1004 - Application-
defined or Object-defined error.

Doh!

Nigel[_2_]

Modify Data Validation Input Message
 
Well it worked for me (xl2007). Since you are using Selection, have you
selected a range with Validation allocated? Try fully referencing the
range.


--

Regards,
Nigel




"tony" wrote in message
...
Cheers Nigel,

No joy there either, I get the run time error 1004 - Application-
defined or Object-defined error.

Doh!



Nigel[_2_]

Modify Data Validation Input Message
 
correction, it only works if the validation parameters are the same.

Try this strategy.

Select entire range to have any validation to some default setting, with the
titles and messages in place, then selectively modify the validation rules,
exclude the titles and messages which you do not want to change.

I think this is the reverse of your approach, I tried it and it appeared to
work OK



--

Regards,
Nigel




"Nigel" wrote in message
...
Well it worked for me (xl2007). Since you are using Selection, have you
selected a range with Validation allocated? Try fully referencing the
range.


--

Regards,
Nigel




"tony" wrote in message
...
Cheers Nigel,

No joy there either, I get the run time error 1004 - Application-
defined or Object-defined error.

Doh!




tony[_4_]

Modify Data Validation Input Message
 
Many thanks for your suggestions Nigel,

I think the problem could be down to the fact that the spreadsheet has
to be usable by all version of excel not just 2007.

I'm not going to pursue this any further as it'll probably cause
problems to other users of the spreadsheet.

Once again thanks for your help.

Regards

Tony


All times are GMT +1. The time now is 09:41 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com