select listbox item automatically

I

ilyaskazi

I hv 2 listboxes on userform..

If user is selecting the text of listbox1 then
get its index and select the text of listbox2(index of listbox1)
next also remove the selected item from both listboxes on clicking
remove btn.
 
B

Bob Phillips

Private Sub cmdRemove_Click()
Range("A1").Offset(ListBox1.ListIndex).Delete
Range("B1").Offset(ListBox1.ListIndex).Delete
End Sub

Private Sub ListBox1_Click()
ListBox2.ListIndex = ListBox1.ListIndex
End Sub

This assumes that the source of the listboxes is A1:A10, B1:B10
 
I

ilyaskazi

Although i wanted the help for userform's listbox, it is solved takin
some similar codes

It is perfect as always, Mr Bob.. Thankyou
 
I

ilyaskazi

i do not want to accept any item in listbox if it is already existing

show msgbox of already exis
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top