Listbox on Userform and a worksheet Excel VBA

DThib

Active Member
Joined
Mar 19, 2010
Messages
464
Office Version
  1. 365
Platform
  1. Windows
Arrgh!,

Last code for this complex thing.
My quandary is using the TextBox (SPR_IDTB) from a userform to populate a ListBox on the userform.
If the matching ID (SPR_IDTB) is found, pull the value in the same row from column A and from Column J. End after searching 1 worksheet. TextBox value is in row B.

Best guess at this point:
Code:
Sub Reslcomm_TB_Change()
   
    Dim c As Range
    Alcomm_LB.Clear
    For Each c In Sheets("Assigned").Range("B:B").End(xlUp)
        If c.Value = SPR_IDTB.Value Then
            Alcomm_LB.AddItem c.Offset(, 12).Value
            Alcomm_LB.AddItem c.Offset(, -1).Value
            Alcomm_LB.List(Alcomm_LB.ListCount - 1, 1) = c.Offset(, 1).Value
        End If
    Next


End Sub
DThib
 
Last edited:
Glad you figured it out & thanks for the feedback
 
Upvote 0

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
OK. I tried. I get information but I also get a lot of extraneous information.

The test should only, at most, generate 4 lines. These entries match the SPR_IDTB value.

I keep getting extraneous information that list all entries in the worksheet.

Any ideas?
Code:
Sub Lister()
   
    Dim c As Range


     For Each c In Sheets("Resolved").Range("B2", Sheets("Resolved").Range("B" & Rows.Count).End(xlUp))


            Reslcomm_LB.AddItem c.Offset(, -1).Value
            Reslcomm_LB.List(Reslcomm_LB.ListCount - 1, 1) = c.Offset(, 8).Value


    Next


End Sub
 
Last edited:
Upvote 0
That's because you have removed the code that checks if the cell value equals the textbox value.
 
Upvote 0
Blonde mistake.

Thanks for catching it.
Works now
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,205
Members
448,554
Latest member
Gleisner2

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