Select Case Not Working

BrianExcel

Well-known Member
Joined
Apr 21, 2010
Messages
975
I am using the following code. Basically, when I select Three from the first list box, the "Three" range should display in the second list box, but nothing happens when I click, regardless of what value....thoughts?

Code:
Sub lbxFloor_Click()
Dim sText As String

    For x = 0 To UserForm1.lbxFloor.ListCount - 1
        If UserForm1.lbxFloor.Selected(x) Then
            sText = UserForm1.lbxFloor.Value
        End If
    Next x

    With Sheets("Printer Data")
        UserForm1.lbxPrinterList.Clear
        Select Case sText
            Case Three
                UserForm1.lbxPrinterList.RowSource = "rThree"
            Case Six
                UserForm1.lbxPrinterList.RowSource = "rSix"
            Case Fifteen
                UserForm1.lbxPrinterList.RowSource = "rFifteen"
        End Select
    End With
End Sub
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
should it be
Code:
Case [COLOR=Red][B]"[/B][/COLOR]Three[B][COLOR=Red]"[/COLOR][/B]
  UserForm1.lbxPrinterList.RowSource = "rThree"
Case [B][COLOR=Red]"[/COLOR][/B]Six[COLOR=Red][B]"[/B][/COLOR]
   UserForm1.lbxPrinterList.RowSource = "rSix"
Case [B][COLOR=Red]"[/COLOR][/B]Fifteen[B][COLOR=Red]"[/COLOR][/B]
 
Upvote 0

Forum statistics

Threads
1,224,502
Messages
6,179,126
Members
452,890
Latest member
Nikhil Ramesh

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