E
Excel-erate2004
Hello to all,
Using the code below, I'm trying to display the selected items by
user from listbox1 in a message box and have the user confirm thei
selections using vbyes (send selection to Comboboxes on sheet2) o
vbno (do nothing & start again).
How can I go about doing this, I've tried setting up a message box t
pass in the selections, but cant seem to configure it properly.
Code
-------------------
Dim intIndex As Integer
Dim intComboIndex As Integer
Dim shtOne As Worksheet
Dim shtTwo As Worksheet
Dim Msg As String
Set shtOne = Worksheets("Step 1")
Set shtTwo = Worksheets("Step 2")
For intIndex = 0 To shtOne.OLEObjects("ListBox1").Object.ListCount - 1
If shtOne.OLEObjects("ListBox1").Object.Selected(intIndex) Then
intComboIndex = intComboIndex + 1
With shtTwo.OLEObjects("ComboBox" & intComboIndex).Object
'.Clear
' sets the combobox to the value selected in the listbox
.Value = shtOne.OLEObjects("ListBox1").Object.List(intIndex)
End With
End If
Next
[\code]
One other point noting, is there a way that I can have the selections sent to the Combobox on sheet 2 based on the order that they are selected.
Right now it only takes those that are selected based on the order that they appear in the list.
Thanks for any help I can get
Using the code below, I'm trying to display the selected items by
user from listbox1 in a message box and have the user confirm thei
selections using vbyes (send selection to Comboboxes on sheet2) o
vbno (do nothing & start again).
How can I go about doing this, I've tried setting up a message box t
pass in the selections, but cant seem to configure it properly.
Code
-------------------
Dim intIndex As Integer
Dim intComboIndex As Integer
Dim shtOne As Worksheet
Dim shtTwo As Worksheet
Dim Msg As String
Set shtOne = Worksheets("Step 1")
Set shtTwo = Worksheets("Step 2")
For intIndex = 0 To shtOne.OLEObjects("ListBox1").Object.ListCount - 1
If shtOne.OLEObjects("ListBox1").Object.Selected(intIndex) Then
intComboIndex = intComboIndex + 1
With shtTwo.OLEObjects("ComboBox" & intComboIndex).Object
'.Clear
' sets the combobox to the value selected in the listbox
.Value = shtOne.OLEObjects("ListBox1").Object.List(intIndex)
End With
End If
Next
[\code]
One other point noting, is there a way that I can have the selections sent to the Combobox on sheet 2 based on the order that they are selected.
Right now it only takes those that are selected based on the order that they appear in the list.
Thanks for any help I can get