• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to use "Select Case" with List Box

Hi, I am working on an excel vba project.I have the following controls on the form.
1.User Form
2.Fram
3.Two List Boxes
4.Option Buttons
5.Text Boxes

I want that when i select any item in the List Box 1 ,the caption of Fram and optionbutton change accordingly.I have write a code using select case but it work only for the first two items and after that the code is doing nothing.I have attached the file please let me guide to correct the code.Thanks
 

Attachments

  • Cash Book 2020 - Copy.xlsm
    33.9 KB · Views: 5
Your code doesn't really make sense as written. All you need to do is check the Listindex of the control:

Code:
Select Case Listbox1.Listindex
Case 0
' first item
Case 1 
'second item
Case 2
' third item
End Select
 
Back
Top