Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default Multiple entries from a drop down list

I assume you're using an ActiveX listbox control and it has multiselect
enabled

the example resizes an area on the sheet, starting at C1 and each time an
item in the listbox is selected, the code will repopulate the table

so on the sheet's code page (right-click the sheet tab and select View Code
from the popup) paste this in:


Option Explicit
Private Sub ListBox1_Change()
Dim i As Long
Dim os As Long
With Range("C1")
.Resize(ListBox1.ListCount).ClearContents
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then
.Offset(os) = ListBox1.List(i)
os = os + 1
End If
Next
End With
End Sub

"Tech_Wolf" wrote in message
...
I need to be able to select multiple entries from a drop down tab that
references a named list elsewhere in the workbook. I am able to get the
drop
down tab to funtion, however it refuses to project those selections into a
different cell, or select multiple entries from the list. I have tried
various sample codes, as suggested in other posts, however when I copy
that
code over to my spreadsheet, it does not work. I can provide the specific
files if need
be. Any suggestions?
Heres the code I'm currently using

Option Explicit

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
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



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
Multiple Entries via Drop Down Tech_Wolf Excel Discussion (Misc queries) 0 July 23rd 09 01:21 PM
Drop Down Won't Display Last Entries in List Rick J[_2_] Excel Programming 0 October 3rd 08 02:37 PM
How many entries can be put into a drop down list in excel? Mary A Excel Worksheet Functions 1 July 26th 06 09:06 PM
multiple item entries from drop-down list sgoldstand Excel Discussion (Misc queries) 3 May 24th 06 06:25 PM
multiple select from the drop down list in excel. list in one sheet and drop down in sriramus Excel Discussion (Misc queries) 5 October 27th 05 06:55 PM


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