ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   data validation - select multiple options? (https://www.excelbanter.com/excel-discussion-misc-queries/62686-data-validation-select-multiple-options.html)

A.

data validation - select multiple options?
 
Is it possible to create a similar function like data validation, from which
I can select multiple options?

(Background: I need a list of many names, from which I case by case can
select).

Dave Peterson

data validation - select multiple options?
 
Not really.

Maybe you could use a listbox.

I added a listbox from the Forms toolbar to a worksheet.
I called it "List Box 1".

I rightclicked on that listbox and chose Format Control. On the Control tab, I
chose Selection Type of Multi. I also pointed at the range that held the values
that go in that listbox.

Then I added a button from the Forms toolbar (I click the button when I'm done
with my selections).

Then I assigned this code to the button:

Option Explicit
Sub testme()

Dim myLB As ListBox
Dim iCtr As Long
Dim myCell As Range

Dim myRng As Range

With ActiveSheet
Set myLB = .ListBoxes("list box 1")
Set myCell = .Range("B1")
End With

With myLB
ActiveSheet.Range("B1").Resize(.ListCount, 1).ClearContents

For iCtr = 1 To .ListCount
If .Selected(iCtr) Then
myCell.Value = .List(iCtr)
Set myCell = myCell.Offset(1, 0)
'.Selected(iCtr) = False
End If
Next iCtr
End With
End Sub

I commented the ".Selected(ictr) = false". Uncomment that line if you want the
selections cleared after the range is updated.

And I put the selected items in B1:B???

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

A. wrote:

Is it possible to create a similar function like data validation, from which
I can select multiple options?

(Background: I need a list of many names, from which I case by case can
select).


--

Dave Peterson

RagDyeR

data validation - select multiple options?
 
Not exactly what you asked, but see if this might be able to help you.

As you pick from the list, the choices are eliminated from the display,
preventing duplicate selections.

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

--

HTH,

RD
================================================== ===
Please keep all correspondence within the Group, so all may benefit!
================================================== ===

"A." wrote in message
...
Is it possible to create a similar function like data validation, from which
I can select multiple options?

(Background: I need a list of many names, from which I case by case can
select).



Debra Dalgleish

data validation - select multiple options?
 
In addition to Dave's suggestion, there's a sample file here that also
uses programming:

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

Under Data Validation, look for 'Select Multiple Items from Dropdown List'


A. wrote:
Is it possible to create a similar function like data validation, from which
I can select multiple options?

(Background: I need a list of many names, from which I case by case can
select).



--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html



All times are GMT +1. The time now is 10:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com