Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA Inserted Data Validation Fails

I am trying to use Dynamic Data Validation inserted at run time but it fails
consistantly with : Method 'Add' of Object 'Validation' failed.

The most basic snippet I tried was:
-------------------------------------------
---sub cmdClick()

Dim wks As Worksheet

Set wks = Worksheets("sheet1")

wks.Range("A1").Validation.Add xlValidateList, , , "=1,2,3"


The parent sheet is full of ADO 2.8 and other code that is fine. It is only
this functionality that fails.

Is there some other property to set or enable? I cannot find anywhere
speicifying any other object requirements.

Any help on this will be greatly appreciated.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default VBA Inserted Data Validation Fails

RickK

Two things:

Get rid of the equal sign in your list.
Also, if you run this more than once, you need to delete the validation,
before you can add it:

With wks.Range("a1").Validation
.Delete
.Add xlValidateList, , , "1,2,3"
End With

hth,

Doug
"_RickK" wrote in message
...
I am trying to use Dynamic Data Validation inserted at run time but it
fails
consistantly with : Method 'Add' of Object 'Validation' failed.

The most basic snippet I tried was:
-------------------------------------------
---sub cmdClick()

Dim wks As Worksheet

Set wks = Worksheets("sheet1")

wks.Range("A1").Validation.Add xlValidateList, , , "=1,2,3"


The parent sheet is full of ADO 2.8 and other code that is fine. It is
only
this functionality that fails.

Is there some other property to set or enable? I cannot find anywhere
speicifying any other object requirements.

Any help on this will be greatly appreciated.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default VBA Inserted Data Validation Fails

RickK,

It works for me and I can't think of what the issue might be.

Doug

"_RickK" wrote in message
...
No luck. Still have the same error popping up. I am on 2003 SP2 and also
got the same error on 2000.

"Doug Glancy" wrote:

RickK

Two things:

Get rid of the equal sign in your list.
Also, if you run this more than once, you need to delete the validation,
before you can add it:

With wks.Range("a1").Validation
.Delete
.Add xlValidateList, , , "1,2,3"
End With

hth,

Doug
"_RickK" wrote in message
...
I am trying to use Dynamic Data Validation inserted at run time but it
fails
consistantly with : Method 'Add' of Object 'Validation' failed.

The most basic snippet I tried was:
-------------------------------------------
---sub cmdClick()

Dim wks As Worksheet

Set wks = Worksheets("sheet1")

wks.Range("A1").Validation.Add xlValidateList, , , "=1,2,3"


The parent sheet is full of ADO 2.8 and other code that is fine. It is
only
this functionality that fails.

Is there some other property to set or enable? I cannot find anywhere
speicifying any other object requirements.

Any help on this will be greatly appreciated.







  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default VBA Inserted Data Validation Fails

The sheet isn't protected, is it? That would get you the error.

Doug

"Doug Glancy" wrote in message
...
RickK,

It works for me and I can't think of what the issue might be.

Doug

"_RickK" wrote in message
...
No luck. Still have the same error popping up. I am on 2003 SP2 and
also
got the same error on 2000.

"Doug Glancy" wrote:

RickK

Two things:

Get rid of the equal sign in your list.
Also, if you run this more than once, you need to delete the validation,
before you can add it:

With wks.Range("a1").Validation
.Delete
.Add xlValidateList, , , "1,2,3"
End With

hth,

Doug
"_RickK" wrote in message
...
I am trying to use Dynamic Data Validation inserted at run time but it
fails
consistantly with : Method 'Add' of Object 'Validation' failed.

The most basic snippet I tried was:
-------------------------------------------
---sub cmdClick()

Dim wks As Worksheet

Set wks = Worksheets("sheet1")

wks.Range("A1").Validation.Add xlValidateList, , , "=1,2,3"


The parent sheet is full of ADO 2.8 and other code that is fine. It
is
only
this functionality that fails.

Is there some other property to set or enable? I cannot find anywhere
speicifying any other object requirements.

Any help on this will be greatly appreciated.









Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formula Based Data Validation 4 Date To Be Inserted FARAZ QURESHI Excel Discussion (Misc queries) 1 August 28th 07 09:28 AM
Validation fails on copying x6v87qe Excel Discussion (Misc queries) 3 May 8th 07 09:10 AM
How are symbols inserted in a data validation look-up list? KJJL1 Excel Worksheet Functions 0 September 11th 06 08:56 AM
Validation List Definition Fails for Some Regional Settings [email protected] Excel Programming 5 February 11th 04 03:08 PM
Cell Protection fails with validation lists AMiddleton Excel Programming 1 January 6th 04 04:00 PM


All times are GMT +1. The time now is 11:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"