Fill a ListBox with extracted data

jimayers

Board Regular
Joined
Nov 14, 2010
Messages
99
Hello, can anybody help with this?
I have a list box that I want populated by extracted date from this code:
Code:
Sub Listing_Cousrse_Titles()
Application.ScreenUpdating = False
Dim r, a, Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
a = 6
If Cells(a, 37) <> xlnull Then
    MsgBox ("Proceedure already performed.")
    Exit Sub
End If
For r = 1 To Lastrow
    If Cells(a, 37) <> xlnull Then a = a + 1
    If Cells(r, 1) = "COURSE TITLE:" Then Cells(a, 37) = Cells(r, 3)
    If Cells(a, 37) = Cells(a - 1, 37) Then Cells(a, 37).Delete
Next r
Application.ScreenUpdating = True
End Sub
The above produces a list of about 12 course titles in column 37, and are what I want added to my list box.
I thought that maybe I should insert .Additem something like this:
Code:
Sub Listing_Cousrse_Titles()
Application.ScreenUpdating = False
Dim r, a, Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
a = 6
If Cells(a, 37) <> xlnull Then
    MsgBox ("Proceedure already performed.")
    Exit Sub
End If
For r = 1 To Lastrow
    If Cells(a, 37) <> xlnull Then a = a + 1
    If Cells(r, 1) = "COURSE TITLE:" Then Cells(a, 37) = Cells(r, 3)
        [SIZE=3][B]Sheets(1).listbox1.additem(cells(r, 3).value)[/B][/SIZE]
    If Cells(a, 37) = Cells(a - 1, 37) Then Cells(a, 37).Delete
Next r
Application.ScreenUpdating = True
End Sub
I have yet to get it to work. Any help would be appreciated - thanks - Jim A
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
How did you create the listbox?
 
Upvote 0

Forum statistics

Threads
1,214,657
Messages
6,120,769
Members
448,991
Latest member
Hanakoro

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