Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List box Question 1

Status
Not open for further replies.

traveller4

Programmer
Sep 18, 2002
62
CA
I have populated a list box that has two columns.

I want to display both columns in a message box but all that comes up is the first column

Here is my load code

Dim intrCount As Long
Dim i As Long
Dim arFill()


Sheets("CaseSetup").Select
Range("A2").Activate

Set dbRange = ActiveCell.CurrentRegion

intrCount = dbRange.Rows.Count

ReDim arFill(1 To intrCount, 1 To 2)

For i = 1 To intrCount
arFill(i, 1) = Sheets("CaseSetup").Cells(i, 2)
Next i
For i = 1 To intrCount
arFill(i, 2) = Sheets("CaseSetup").Cells(i, 1)
Next i
ListBox1.ColumnCount = 2
ListBox1.List = arFill


When the user make the selection and then goes to save to the spreadsheet I want to display a message box.

The best I seem to be able to do is get the 1st column to display in the message box.

Dim Msg As String

Msg = ""


Msg = lstSetCase.Value

MsgBox ("You have selected: " & Msg)

Is there a way to extract the first and the second column
so I can put them in a message box

--thanks in advance



 
Have you tried this ?
Msg = lstSetCase.Column(0) & " - " & lstSetCase.Column(1)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
PHV

Thanks again for yous help

I thought I tried

Msg = lstSetCase.Column(1) & " - " & lstSetCase.Column(2)

and got an error. Obviously I forgot Arrays are zero based

Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top