PC Review


Reply
Thread Tools Rate Thread

detect validation list

 
 
=?Utf-8?B?c3Zi?=
Guest
Posts: n/a
 
      17th Oct 2006
I have a form that contains a listbox of items. When an item is
double-clicked a row of values is entered at the next available row in the
worksheet. Some of the cells in the newly appended row contain validation
lists. I have various types of lists and in some cases when an item is
selected from a list I need to dynamically create a corresponding validation
list in the cell to the right of it. I can do this bit. The problem I have is
that I need to detect whether the current cell contains a validation list as
not all cells will be validation lists. The code will be in the
Worksheet_Change event. I have looked at the Target argument and
Target.Validation, but cannot find a property to give me the info I need. Any
help would be greatly appreciated.
 
Reply With Quote
 
 
 
 
Jim Rech
Guest
Posts: n/a
 
      17th Oct 2006
If the cell's validation type is 3 it has a validation list. And the list's
address is returned with Validation.Formula1.

--
Jim
"svb" <(E-Mail Removed)> wrote in message
news:949E31E2-8100-4B4B-BA35-(E-Mail Removed)...
|I have a form that contains a listbox of items. When an item is
| double-clicked a row of values is entered at the next available row in the
| worksheet. Some of the cells in the newly appended row contain validation
| lists. I have various types of lists and in some cases when an item is
| selected from a list I need to dynamically create a corresponding
validation
| list in the cell to the right of it. I can do this bit. The problem I have
is
| that I need to detect whether the current cell contains a validation list
as
| not all cells will be validation lists. The code will be in the
| Worksheet_Change event. I have looked at the Target argument and
| Target.Validation, but cannot find a property to give me the info I need.
Any
| help would be greatly appreciated.


 
Reply With Quote
 
=?Utf-8?B?c3Zi?=
Guest
Posts: n/a
 
      17th Oct 2006
Thanks Jim, that will do nicely. The only point I have is that If I do
something like,

If Target.Validation.Type = 3 Then
'// and do some stuff
End If

and the cell I change does not have a validation, which will happen as not
all cells have lists, then I receive an application error. This is not a
problem though as I can trap the error and continue.

"Jim Rech" wrote:

> If the cell's validation type is 3 it has a validation list. And the list's
> address is returned with Validation.Formula1.
>
> --
> Jim
> "svb" <(E-Mail Removed)> wrote in message
> news:949E31E2-8100-4B4B-BA35-(E-Mail Removed)...
> |I have a form that contains a listbox of items. When an item is
> | double-clicked a row of values is entered at the next available row in the
> | worksheet. Some of the cells in the newly appended row contain validation
> | lists. I have various types of lists and in some cases when an item is
> | selected from a list I need to dynamically create a corresponding
> validation
> | list in the cell to the right of it. I can do this bit. The problem I have
> is
> | that I need to detect whether the current cell contains a validation list
> as
> | not all cells will be validation lists. The code will be in the
> | Worksheet_Change event. I have looked at the Target argument and
> | Target.Validation, but cannot find a property to give me the info I need.
> Any
> | help would be greatly appreciated.
>
>
>

 
Reply With Quote
 
Jim Rech
Guest
Posts: n/a
 
      18th Oct 2006
>>then I receive an application error

Right. Kind of ugly for Excel to blow on things like this but, as you say,
you can trap it.

--
Jim
"svb" <(E-Mail Removed)> wrote in message
news:097F3DBE-1093-446E-9C74-(E-Mail Removed)...
| Thanks Jim, that will do nicely. The only point I have is that If I do
| something like,
|
| If Target.Validation.Type = 3 Then
| '// and do some stuff
| End If
|
| and the cell I change does not have a validation, which will happen as not
| all cells have lists, then I receive an application error. This is not a
| problem though as I can trap the error and continue.
|
| "Jim Rech" wrote:
|
| > If the cell's validation type is 3 it has a validation list. And the
list's
| > address is returned with Validation.Formula1.
| >
| > --
| > Jim
| > "svb" <(E-Mail Removed)> wrote in message
| > news:949E31E2-8100-4B4B-BA35-(E-Mail Removed)...
| > |I have a form that contains a listbox of items. When an item is
| > | double-clicked a row of values is entered at the next available row in
the
| > | worksheet. Some of the cells in the newly appended row contain
validation
| > | lists. I have various types of lists and in some cases when an item is
| > | selected from a list I need to dynamically create a corresponding
| > validation
| > | list in the cell to the right of it. I can do this bit. The problem I
have
| > is
| > | that I need to detect whether the current cell contains a validation
list
| > as
| > | not all cells will be validation lists. The code will be in the
| > | Worksheet_Change event. I have looked at the Target argument and
| > | Target.Validation, but cannot find a property to give me the info I
need.
| > Any
| > | help would be greatly appreciated.
| >
| >
| >


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Data Validation -> Validation list is larger than the cell width Barb Reinhardt Microsoft Excel Programming 1 4th Mar 2010 08:24 PM
How to detect a Validation Object in a Cell using VBA? keithb Microsoft Excel Discussion 1 2nd Aug 2005 11:14 PM
Re: Validation (Drop down list vs simple text length validation) Bob Phillips Microsoft Excel Programming 2 27th Apr 2004 07:47 PM
Re: Validation (Drop down list vs simple text length validation) Jason Morin Microsoft Excel Programming 1 27th Apr 2004 04:56 PM
Validation (Drop down list vs simple text length validation) Pete McCosh Microsoft Excel Programming 0 27th Apr 2004 03:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:40 AM.