How to use listbox double click in order to put the value into 10 different labels in form?

ping0775

New Member
Joined
Jul 18, 2022
Messages
40
Office Version
  1. 2007
Platform
  1. Windows
How to use listbox double click in order to put the value into 10 different labels in form?
i been trying so hard
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)

IssueDOCumSalesInvoiceForm.ItemCode1.Caption = Me.ListBox1.Text
IssueDOCumSalesInvoiceForm.ItemCode2.Caption
IssueDOCumSalesInvoiceForm.ItemCode3.Caption..to 10 etc

i should transfer the data to sheet first by using
IRow = Sheet6.Range("a" & Rows.Count).End(xlUp).Row + 1 ?
then from there put cell value to label?
or any alternative way to solve?
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
IssueDOCumSalesInvoiceForm.ItemCode1.Caption = Me.ListBox1.Text
End Sub

Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
IssueDOCumSalesInvoiceForm.ItemCode2.Caption = Me.ListBox1.Text
End Sub
do you mean like this?
is doesnt work
by the way the listbox is in a form ,gonna transfer to another form.
 
Upvote 0
Hard to know what to suggest when you don't say what the problem is. If the code is on the same form you should be able to get by with
Me.ItemCode1.Caption = Me.Listbox1
I would probably use a loop rather than code 10 similar lines, assuming there are 10 labels whose name ends in numbers from 1 to 10.
I tested and it works for me.
 
Upvote 0
Hard to know what to suggest when you don't say what the problem is. If the code is on the same form you should be able to get by with
Me.ItemCode1.Caption = Me.Listbox1
I would probably use a loop rather than code 10 similar lines, assuming there are 10 labels whose name ends in numbers from 1 to 10
Yea correct i need to loop from 1 listbox to 10 different labels is 2 different forms by double click, it will in order add up to label1 to label 10
 
Upvote 0
I was leading more to

VBA Code:
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
[QUOTE="ping0775, post: 5916125, member: 495700"]
IssueDOCumSalesInvoiceForm.ItemCode1.Caption = Me.ListBox1.Text
IssueDOCumSalesInvoiceForm.ItemCode2.Caption = Me.ListBox1.Text
IssueDOCumSalesInvoiceForm.ItemCode3.Caption = Me.ListBox1.Text
'etc'
End Sub
[/QUOTE]
 
Upvote 0
So you want each one of 10 list items to go into a different label caption? There are and will only ever be 10 listbox items?
 
Upvote 0
So you want each one of 10 list items to go into a different label caption? There are and will only ever be 10 listbox items?
Yea correct, ist possible?
I have 2 forms
Form A
this form contain ten lables.
Form B
this form contain one listbox loading the productlist.

one i double click the listbox in Form B
the item will be show into Form A Label box in order mode
one double click , the clicked item will be shown in Label1
another double, the second clicked item will be shown in Label2
and so on to labels 10
 
Upvote 0

Forum statistics

Threads
1,215,396
Messages
6,124,685
Members
449,179
Latest member
kfhw720

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top