close

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

Not really.

Maybe you could use a listbox.

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

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(quot;list box 1quot;)
Set myCell = .Range(quot;B1quot;)
End With

With myLB
ActiveSheet.Range(quot;B1quot;).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 quot;.Selected(ictr) = falsequot;. 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:
www.mvps.org/dmcritchie/excel/getstarted.htm

A. wrote:
gt;
gt; Is it possible to create a similar function like data validation, from which
gt; I can select multiple options?
gt;
gt; (Background: I need a list of many names, from which I case by case can
gt; select).

--

Dave Peterson

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.

www.contextures.com/xlDataVal03.html

--

HTH,

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

quot;A.quot; gt; 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).
In addition to Dave's suggestion, there's a sample file here that also
uses programming:

www.contextures.com/excelfiles.html

Under Data Validation, look for 'Select Multiple Items from Dropdown List'A. wrote:
gt; Is it possible to create a similar function like data validation, from which
gt; I can select multiple options?
gt;
gt; (Background: I need a list of many names, from which I case by case can
gt; select).--
Debra Dalgleish
Excel FAQ, Tips amp; Book List
www.contextures.com/tiptech.html

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()