vlookup using a listbox for item to search for and the next column over to be an answer that changes the value in option buttons

GBDavis

New Member
Joined
May 22, 2019
Messages
10
I am trying to have the user choose a serial number in a list and from that the option box will change.

here is the partial code i am trying.

lsn=worksheetfunction.VLookup(lstSN.Value,worksheets("Serial Numbers").Range("a":"b"),2,False)
if lsn="" then exit sub
else if lsn="25 in_lbs +/- 6%" then
optionbutton1 = true
else if lsn="35 in_lbs +/- 6%" then
optionbutton2 = true
else if lsn="55 in_lbs +/- 6%" then
optionbutton3 = true
else if lsn="65 in_lbs +/- 6%" then
optionbutton4 = true

any ideas?
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Try this

Code:
Private Sub lstSN_Click()
    Dim f As Range, lsn As String


    Set f = Worksheets("Serial Numbers").Range("A:A").Find(lstSN, LookIn:=xlValues, lookat:=xlWhole)
    If Not f Is Nothing Then
        lsn = f.Offset(0, 1).Value
        Select Case lsn
            Case "25 in_lbs +/- 6%": OptionButton1 = True
            Case "35 in_lbs +/- 6%": OptionButton2 = True
            Case "55 in_lbs +/- 6%": OptionButton3 = True
            Case "65 in_lbs +/- 6%": OptionButton4 = True
        End Select
    End If
End Sub
 
Upvote 0
I placed the code in and nothing seems to happen. No error and the radio buttons do not change. do you have any other ideas? Thank you
 
Upvote 0
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

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