Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
joe joe is offline
external usenet poster
 
Posts: 62
Default Dymanically add to validation list

I am using XL 2002

I have a cell in which I have set it's values to a validation list of sales people. Is is possible to update the list by having the user type in a new sales person's name and then have code add the name to the validation list? I don't think so, but I thought that I would ask the experts

Thanks

Joe
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Dymanically add to validation list

Hi
see
http://www.contextures.com/excelfiles.html

and look for the example file:
Update Validation List


--
Regards
Frank Kabel
Frankfurt, Germany


Joe wrote:
I am using XL 2002.

I have a cell in which I have set it's values to a validation list of
sales people. Is is possible to update the list by having the user
type in a new sales person's name and then have code add the name to
the validation list? I don't think so, but I thought that I would
ask the experts.

Thanks,

Joe


  #3   Report Post  
Posted to microsoft.public.excel.programming
joe joe is offline
external usenet poster
 
Posts: 62
Default Dymanically add to validation list

Thanks you

----- VBAexpert wrote: ----

Hi Mike

Yes it is possible to do this. As an example, the following code will add anything entered in column D to the validation list in cell B4

Private Sub Worksheet_Change(ByVal Target As Range
If Target.Column = 4 The
Dim OldList As Strin
With [b4].Validatio
OldList = .Formula
.Delet
.Add Type:=xlValidateList, Formula1:=OldList & "," & Target.Tex
End Wit
End I
End Su

This code must be placed in the worksheet's event code module. To do this, right-click on the worksheet tab, select View Code, and paste the code into the Code Pane

This code assumes that the validation list is a literal list, NOT a range containing a list. For example, the list could be "joe, fred, george, susan, mike". The limitation of this is that I believe the length of the string cannot exceed 255 characters. If you want to enable the list to have arbitrary (i.e., very large) length you would have to use the range reference method, which would mean that the code would have to add the name to the range list. You could then keep from having to update the cell's validation list by using a Dynamic Range reference as the validation list. If you want the code for this, send me an email

Keep Excelling

Damon
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
dymanically generate chart, based on multiple values OTWarrior via OfficeKB.com Charts and Charting in Excel 2 July 4th 07 03:38 PM
data validation invalid in dynamic validation list ilia Excel Discussion (Misc queries) 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 06:55 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"