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

Hi everybody , I need to define an validation list to somes cells in my
worksheet using source code, is it possible ?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Validation List

Do it in Excel with the macro recorder on. That will give you the code.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Angeles" wrote in message
...
Hi everybody , I need to define an validation list to somes cells in my
worksheet using source code, is it possible ?




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Validation List

Angeles,

Try turning on the Macro Recorder and then adding some validation to some
cells. The recorded code will give you a very good start.

hth,

Doug

"Angeles" wrote in message
...
Hi everybody , I need to define an validation list to somes cells in my
worksheet using source code, is it possible ?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Validation List

Sorry , but how do I activate the Macro Recorder ?

"Doug Glancy" wrote:

Angeles,

Try turning on the Macro Recorder and then adding some validation to some
cells. The recorded code will give you a very good start.

hth,

Doug

"Angeles" wrote in message
...
Hi everybody , I need to define an validation list to somes cells in my
worksheet using source code, is it possible ?




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Validation List

Angeles,

In Excel's Tools menu choose "Macros" then choose "Record New Macro".
Choose to save it to ThisWorkbook. The Record Macro toolbar will appear on
the screen. Dthe steps to enter your validation and then press the Stop
button on the Macro Recorder toolbar. Then go into the Visual Basic Editor.
Your recorded macro will be in "Module1" or similar in the workbook you did
the validation in.

hth,

Doug

"Angeles" wrote in message
...
Sorry , but how do I activate the Macro Recorder ?

"Doug Glancy" wrote:

Angeles,

Try turning on the Macro Recorder and then adding some validation to some
cells. The recorded code will give you a very good start.

hth,

Doug

"Angeles" wrote in message
...
Hi everybody , I need to define an validation list to somes cells in my
worksheet using source code, is it possible ?







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Validation List

I got it , thank you.

One more question , is it posible to let the user adds more values to this
list , for example , if the list values are : Class 1, Class 2, Class 3. Is
it posible that the user writes one new value and add that value to my
Validation List (if the value is new)?

"Angeles" wrote:

Sorry , but how do I activate the Macro Recorder ?

"Doug Glancy" wrote:

Angeles,

Try turning on the Macro Recorder and then adding some validation to some
cells. The recorded code will give you a very good start.

hth,

Doug

"Angeles" wrote in message
...
Hi everybody , I need to define an validation list to somes cells in my
worksheet using source code, is it possible ?




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Validation List

Angeles,

It is possible. You have to capture the old list, delete the validation and
then create new validation it with the new list. Here's an example to get
you started. Obviously, it doesn't address where the new user validation
item comes from:

Sub test()
Dim strFormula1 As String

With Worksheets(1).Range("A1").Validation
strFormula1 = .Formula1 & ",Class 224"
.Delete
.Add Type:=xlValidateList, Formula1:=strFormula1
End With
End Sub

hth,

Doug

"Angeles" wrote in message
...
I got it , thank you.

One more question , is it posible to let the user adds more values to this
list , for example , if the list values are : Class 1, Class 2, Class 3.
Is
it posible that the user writes one new value and add that value to my
Validation List (if the value is new)?

"Angeles" wrote:

Sorry , but how do I activate the Macro Recorder ?

"Doug Glancy" wrote:

Angeles,

Try turning on the Macro Recorder and then adding some validation to
some
cells. The recorded code will give you a very good start.

hth,

Doug

"Angeles" wrote in message
...
Hi everybody , I need to define an validation list to somes cells in
my
worksheet using source code, is it possible ?





  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Validation List

My formula is ... =OFFSET(INDIRECT(SUBSTITUTE($L6,"
","")),0,0,COUNTA(INDIRECT(SUBSTITUTE($L6," ","")&"Col")),1)

If I write ...

With Worksheets(1).Range("A1").Validation
strFormula1 = .Formula1 & =OFFSET(INDIRECT(SUBSTITUTE($L6,"
","")),0,0,COUNTA(INDIRECT(SUBSTITUTE($L6," ","")&"Col")),1)

.Delete
.Add Type:=xlValidateList, Formula1:=strFormula1
End With

I am getting an error message , which is the correct way for writing the
formmula ?

Thank you
Angeles



"Doug Glancy" wrote:

Angeles,

It is possible. You have to capture the old list, delete the validation and
then create new validation it with the new list. Here's an example to get
you started. Obviously, it doesn't address where the new user validation
item comes from:

Sub test()
Dim strFormula1 As String

With Worksheets(1).Range("A1").Validation
strFormula1 = .Formula1 & ",Class 224"
.Delete
.Add Type:=xlValidateList, Formula1:=strFormula1
End With
End Sub

hth,

Doug

"Angeles" wrote in message
...
I got it , thank you.

One more question , is it posible to let the user adds more values to this
list , for example , if the list values are : Class 1, Class 2, Class 3.
Is
it posible that the user writes one new value and add that value to my
Validation List (if the value is new)?

"Angeles" wrote:

Sorry , but how do I activate the Macro Recorder ?

"Doug Glancy" wrote:

Angeles,

Try turning on the Macro Recorder and then adding some validation to
some
cells. The recorded code will give you a very good start.

hth,

Doug

"Angeles" wrote in message
...
Hi everybody , I need to define an validation list to somes cells in
my
worksheet using source code, is it possible ?






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
Crazy Data Validation ... List Validation Not Working TW Bake Excel Programming 1 March 29th 07 02:41 AM
data validation invalid in dynamic validation list ilia Excel Programming 0 November 7th 06 12:54 PM
Validation (Drop down list vs simple text length validation) Bob Phillips[_6_] Excel Programming 2 April 27th 04 07:47 PM
Validation (Drop down list vs simple text length validation) Jason Morin[_2_] Excel Programming 1 April 27th 04 04:56 PM
Validation (Drop down list vs simple text length validation) Pete McCosh Excel Programming 0 April 27th 04 03:49 PM


All times are GMT +1. The time now is 09:44 PM.

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"