Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
nick_thomson
 
Posts: n/a
Default Unique numbers from data validation list


Hi

I have a spreadsheet that has multiple worksheets each containing lists
of items at a warehouse. Each item needs to have a unique number.

When adding items to this spreadsheet I would like, if possible, to
have a function that allows me to choose a unique number from a drop
down data validation list, such that if I were to choose a particular
number from this list in one cell, then that number would be removed
from the list for any subsequent cells. Also, if an item is removed
from any of the worksheets, that item's number should again be
available in the list.

Is this possible with a function?

Many thanks in advance.

Nick Thomson


--
nick_thomson
------------------------------------------------------------------------
nick_thomson's Profile: http://www.excelforum.com/member.php...o&userid=32929
View this thread: http://www.excelforum.com/showthread...hreadid=527536

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips
 
Posts: n/a
Default Unique numbers from data validation list

See http://www.contextures.com/xlDataVal03.html

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"nick_thomson"
wrote in message
news:nick_thomson.25fk6n_1143634203.0645@excelforu m-nospam.com...

Hi

I have a spreadsheet that has multiple worksheets each containing lists
of items at a warehouse. Each item needs to have a unique number.

When adding items to this spreadsheet I would like, if possible, to
have a function that allows me to choose a unique number from a drop
down data validation list, such that if I were to choose a particular
number from this list in one cell, then that number would be removed
from the list for any subsequent cells. Also, if an item is removed
from any of the worksheets, that item's number should again be
available in the list.

Is this possible with a function?

Many thanks in advance.

Nick Thomson


--
nick_thomson
------------------------------------------------------------------------
nick_thomson's Profile:

http://www.excelforum.com/member.php...o&userid=32929
View this thread: http://www.excelforum.com/showthread...hreadid=527536



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Martin
 
Posts: n/a
Default Unique numbers from data validation list

Here's a macro solution. Type your list of numbers into a sheet, select the
list and name the range "inputrange". Highlight the column into which you
want to choose numbers and choose Data, Validation. Choose "List" in the
Allow box and type "=inputrange" as Source and click OK. Then go into the VB
Editor (Alt-F11), double-click on the correct sheet module on the left and
then paste the following into the module window on the right:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim myCell As Range
Dim myFound As Boolean
If Target.Column = 1 Then
If Target.Cells.Count = 1 Then
If Not IsEmpty(Target) Then
If
ActiveWorkbook.Names("inputrange").RefersToRange.F ind(Target.Value).NumberFormat = ";;;" Then
Target.Value = ""
Exit Sub
End If
End If
End If
myFound = False
For Each myCell In ActiveWorkbook.Names("inputrange").RefersToRange
If Not Columns("A:A").Find(myCell.Value) Is Nothing Then myFound
= True
If myFound Then
myCell.NumberFormat = ";;;"
Else
myCell.NumberFormat = "General"
End If
myFound = False
Next
End If
End Sub


"nick_thomson" wrote:


Hi

I have a spreadsheet that has multiple worksheets each containing lists
of items at a warehouse. Each item needs to have a unique number.

When adding items to this spreadsheet I would like, if possible, to
have a function that allows me to choose a unique number from a drop
down data validation list, such that if I were to choose a particular
number from this list in one cell, then that number would be removed
from the list for any subsequent cells. Also, if an item is removed
from any of the worksheets, that item's number should again be
available in the list.

Is this possible with a function?

Many thanks in advance.

Nick Thomson


--
nick_thomson
------------------------------------------------------------------------
nick_thomson's Profile: http://www.excelforum.com/member.php...o&userid=32929
View this thread: http://www.excelforum.com/showthread...hreadid=527536


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
nick_thomson
 
Posts: n/a
Default Unique numbers from data validation list


Thanks Bob and Martin for your replies.

Bob's solution may be too complicated as my workbook has many sheets,
so I tried Martin's macro solution first.

I followed your instructions Martin, but I get a compile syntax error
on the red 'if' below:

If Not IsEmpty(Target) Then
If
ActiveWorkbook.Names("inputrange").RefersToRange.F
ind(Target.Value).NumberFormat = ";;;" Then
Target.Value = ""

I'm pretty hopeless with VB - any ideas?

Cheers

Nick


--
nick_thomson
------------------------------------------------------------------------
nick_thomson's Profile: http://www.excelforum.com/member.php...o&userid=32929
View this thread: http://www.excelforum.com/showthread...hreadid=527536

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Martin
 
Posts: n/a
Default Unique numbers from data validation list

That's just the strange little text editing package M/soft give us here - the
line's word wrapped when it shouldn't! I've tried to correct it below but no
doubt more hard returns will creep in. The "If" up to the "Then" after it
should all be on one row.

Having said that, Bob's solution is better because you don't see gaps in the
dropdown list unlike my rather unorthodox method!

"nick_thomson" wrote:


Thanks Bob and Martin for your replies.

Bob's solution may be too complicated as my workbook has many sheets,
so I tried Martin's macro solution first.

I followed your instructions Martin, but I get a compile syntax error
on the red 'if' below:

If Not IsEmpty(Target) Then
If
ActiveWorkbook.Names("inputrange").RefersToRange.F ind(Target.Value).NumberFormat = ";;;" Then
Target.Value = ""

I'm pretty hopeless with VB - any ideas?

Cheers

Nick


--
nick_thomson
------------------------------------------------------------------------
nick_thomson's Profile: http://www.excelforum.com/member.php...o&userid=32929
View this thread: http://www.excelforum.com/showthread...hreadid=527536


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
How can I average data from a repeating list into a unique list? Duke Carey Excel Worksheet Functions 0 March 3rd 06 06:38 PM
Choices from Data Validation List FeFi Excel Discussion (Misc queries) 2 January 30th 06 12:58 AM
Data Validation - using a list from another workbook PeterW Excel Discussion (Misc queries) 4 December 15th 05 07:18 AM
Data Validation List Length Alex Mackenzie Excel Worksheet Functions 4 November 1st 05 01:27 AM
Expanding Data validation from List mark hansen Excel Discussion (Misc queries) 2 September 4th 05 01:39 AM


All times are GMT +1. The time now is 08:12 PM.

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

About Us

"It's about Microsoft Excel"