View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Rech Jim Rech is offline
external usenet poster
 
Posts: 2,718
Default Excel VBA programmatic validation problem

You have to clear out the previous validation:

Range("E5").Validation.Delete

--
Jim Rech
Excel MVP
"ZoomZoom " wrote in message
...
| Hi, newbie post here - I've trawled the archives and can't seem to find
| an answer to my problem.
| I'm using Win2000/Excel 2000/VB6
|
| Basically I'm trying to add drop down list style validation to a cell.
| I believe this should be possible using the validation parameter of a
| range:
|
| Range("e5").Validation.Add Type:=xlValidateList, _
| AlertStyle:=xlValidAlertStop, _
| Operator:=xlBetween, _
| Formula1:=txt
|
| Where text is a comma separated string ("M,F" in this case)
|
| Every attempt to use validation in such a way gives the error:
| "Run-Time error '1004': Application-defined or object-defined error".
| I've played with many variations on the above syntax, and the same
| error message always results.
|
| Any ideas what I need to do to get this working? Might it be my
| references or something like that?
|
|
| ---
| Message posted from http://www.ExcelForum.com/
|