how to select listbox value in different cells

VBABEGINER

Well-known Member
Joined
Jun 15, 2011
Messages
1,284
Office Version
  1. 365
Platform
  1. Windows
Hi All,

Thanks Expert, reading this query.

I am doing one R&D but i am not able to select a perticular value from the listbox.
From listbox, there are 2 items. if i select 1st value it goes on range c4 and if i select 2nd value i goes on c6 value.

Private Sub ListBox2_Click()
if listbox2.select= a then
Range("c4").select
ListBox2.Value = range("c4")
end if

if listbox2.select= b then
Range("c6").select
ListBox2.Value = range("c6")
end if
End Sub

Any expert, give the suggestion on the above?:lookaway:
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Try this.
Code:
Private Sub ListBox2_Click()
    Select Case ListBox2.ListIndex
        Case 0: Range("C4") = ListBox2.Value
        Case 1: Range("C6") = ListBox2.Value
    End If
End Sub
 
Upvote 0
Hi,

Thank you for your valuable suggestion.

The code u had given me that is not workng.
Not happng any thng.

again i am tryng but, Require ur kind suggestion?
**************************************

ohh sorry.
its working but, both values i can see.

let me try some...i will definatly back to you.
 
Last edited:
Upvote 0
No.
See, wht hapnd here that...i click on "a" that i can see in c4.
as soon as, i click on "b" c4 will clear and only c6 showng the value b.
Right..


ok...is this possble?
 
Upvote 0
done....ok. Thank You Sektor Sir.
I have also stuck in my application.
Kindly provide ur valuable comments on that.
Thank you.
Really Thanks to Mr.Excel !
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,752
Members
452,940
Latest member
rootytrip

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