Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Select Multiple Items and return value for Dropdown or listbox

Since you are building a comma delimited list in a cell you could count
commas and add 1

Function count_commas(r As Range) As Integer
V = r.Formula
count_plus = Len(V) - Len(Replace(V, ",", ""))
End Function


Gord

On Mon, 19 Jan 2009 13:14:00 -0800, kookie
wrote:

I found this code through another post and was able to make it work, Now I am
trying to count. I want a number value for the number of items selected.

Can this be done?

"Gord Dibben" wrote:

Using Data Validation dropdown add this Debra Dalglesih event code to your
worksheet.

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo exitHandler

Dim rngDV As Range
If Target.Count 1 Then GoTo exitHandler

On Error Resume Next
Set rngDV = Cells.SpecialCells(xlCellTypeAllValidation)
On Error GoTo exitHandler
If rngDV Is Nothing Then GoTo exitHandler
If Intersect(Target, rngDV) Is Nothing Then
'do nothing
Else
Application.EnableEvents = False
If Target.Column = 3 Then 'adjust the 3 to your column.
If Target.Value = "" Then GoTo exitHandler
If Target.Offset(0, 1).Value = "" Then
Target.Offset(0, 1).Value = Target.Value
Else
Target.Offset(0, 1).Value = _
Target.Offset(0, 1).Value _
& ", " & Target.Value
End If
End If
End If

exitHandler:
Application.EnableEvents = True

End Sub


Gord Dibben MS Excel MVP

On Mon, 19 Jan 2009 10:22:00 -0800, kookie
wrote:

I have a field I am trying to return the values. I can add a data validation
on a list of languages, but this only returns 1 option.
Is there a way to capture this and add to it each time an additional item is
selected?

or with a listbox that already allows for multiple select, How do you return
the value(s) to another cell comma delimited?




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
Moving Mutli-Column Multiple-Selected Listbox items up or down MP Excel Discussion (Misc queries) 0 January 14th 09 09:34 PM
Can I create a dropdown list to select multiple items Oct1196 Excel Worksheet Functions 2 September 5th 07 08:19 PM
Select an item from dropdown list but return value from adjacent c StevanT Excel Discussion (Misc queries) 4 March 17th 07 12:39 PM
select multiple items from a dropdown list Rebecca1 Excel Worksheet Functions 0 July 17th 06 08:47 PM
Problem using INDEX to select items in listbox Shazbot Excel Discussion (Misc queries) 3 April 28th 06 09:06 AM


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