View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jennifer Jennifer is offline
external usenet poster
 
Posts: 385
Default Listbox selection creates form

Oops I figured it out. The problem was that I had another label for the RFID
text box and one for the date. So now my question is how can I have these
other two lables and it fill the label1label10.

It just never ends! Ha!
--
Though daily learning, I LOVE EXCEL!
Jennifer


"NickHK" wrote:

Jennifer,
On the first form, with your listbox and cmdSelect:

Private Sub UserForm_Initialize()
With ListBox1
.AddItem "Vaccinate"
.AddItem "Deworm"
.AddItem "Neuter"
.AddItem "Inseminate"
.AddItem "Put Down"
End With

End Sub

Private Sub cmdSelect_Click()
Dim i As Long
Dim SelCount As Long

With ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) = True Then
SelCount = SelCount + 1
UserForm2.Controls("Label" & SelCount).Caption = .List(i)
End If
Next
End With

UserForm2.Show

End Sub

UserForm2 has 10 labels called "Label1" ~ "Label10", with some default
caption of "Not set" or blank.
You should add some error trapping/checking that the number of options in
the list box does not exceed the number of available labels.

NickHK

"Jennifer" wrote in message
...
Hello Hello,
Here is a new one. I have a userform with one listbox(lstTreatment) and a
button(cmdSelect). I have it set up so the user can select multiple
selections in the listbox.

Next, I have created another userform that has a text box for the RFID

when
scanned, then there are 10 lables (label1, label2, etc.)

Problem: I would like the selections choosen from the 1st userform to fill
the labels in the second userform. Soooo . . . if the user selects from

the
listbox:
1. Vaccinate
2. Deworm
Those two selections will be the names of label1 and label2.

I hope this makes sense! Thanks guys!

Anyone have any recommendations on classes or great books on learning

FoxPro?
--
Though daily learning, I LOVE EXCEL!
Jennifer