Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default add item to a drop-down list

Hi!
How can a drop-down validated cell (data validation) be automaticaly updated
whem i add an item to the original list.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default add item to a drop-down list

A very tiny trick:

When you insert the new item in the Validation List, insert it in the middle
rather than the end. This way you avoid re-defining the list range.
--
Gary''s Student - gsnu200823


"NazRem" wrote:

Hi!
How can a drop-down validated cell (data validation) be automaticaly updated
whem i add an item to the original list.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default add item to a drop-down list

Thank you, but
can't the re-defining the list range be done automatically when i add an
item to the last available cell of the column? (I want to compare an entry
with the list and if it is not there I want to includ it using a macro)

"Gary''s Student" wrote:

A very tiny trick:

When you insert the new item in the Validation List, insert it in the middle
rather than the end. This way you avoid re-defining the list range.
--
Gary''s Student - gsnu200823


"NazRem" wrote:

Hi!
How can a drop-down validated cell (data validation) be automaticaly updated
whem i add an item to the original list.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default add item to a drop-down list

In this sample, A1 is the cell with validation; column D is the list. This
worksheet event macro detects changes made to column D and re-creates the
validation for A1:

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Set d = Range("D:D")
Set a = Range("A1")
If Intersect(t, d) Is Nothing Then Exit Sub
n = Cells(Rows.Count, "D").End(xlUp).Row
Application.EnableEvents = False
a.Validation.Delete
a.Validation.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop,
Operator:= _
xlBetween, Formula1:="=$D$1:$D$" & n
Application.EnableEvents = True
End Sub
--
Gary''s Student - gsnu200823


"NazRem" wrote:

Thank you, but
can't the re-defining the list range be done automatically when i add an
item to the last available cell of the column? (I want to compare an entry
with the list and if it is not there I want to includ it using a macro)

"Gary''s Student" wrote:

A very tiny trick:

When you insert the new item in the Validation List, insert it in the middle
rather than the end. This way you avoid re-defining the list range.
--
Gary''s Student - gsnu200823


"NazRem" wrote:

Hi!
How can a drop-down validated cell (data validation) be automaticaly updated
whem i add an item to the original list.

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default add item to a drop-down list

Maybe you could use a dynamic range name.

Debra Dalgleish explains dynamic range names he
http://contextures.com/xlNames01.html#Dynamic

NazRem wrote:

Hi!
How can a drop-down validated cell (data validation) be automaticaly updated
whem i add an item to the original list.


--

Dave Peterson
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
ADD ITEM TO A DROP DOWN LIST? William Excel Discussion (Misc queries) 4 September 8th 08 09:05 PM
How do I select more than one item from a drop down pick list? Greg Excel Worksheet Functions 1 January 16th 08 03:08 PM
drop down list/typing item from list error Strike Eagle Loader[_2_] Excel Worksheet Functions 1 May 1st 07 06:35 PM
How do I set up a drop down list to beginning letter of item? kerri Excel Discussion (Misc queries) 1 August 10th 06 06:56 PM
multiple item entries from drop-down list sgoldstand Excel Discussion (Misc queries) 3 May 24th 06 06:25 PM


All times are GMT +1. The time now is 11:21 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"