Fill combo box based on different workbook values

Jaye7

Well-known Member
Joined
Jul 7, 2010
Messages
1,069
Hi all,

I want to fill a userform combo box based on the data from a sheet in a different workbook.

The workbook and worksheet are as follows - Workbooks("Mlist.xlsm").Worksheets("Reminders")

The range is filled from Range("A2:A100") as long as the text in column E is "1 Show"

I want it to add the values from columns B and D also.

Image attached showing an example of spreadsheet data and then the combo box results.

Thanks
 

Attachments

  • combobox.png
    combobox.png
    68.4 KB · Views: 13

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
I solved it.

VBA Code:
LB1.Clear
 
 Dim Sh As Worksheet
 Dim Rng As Range
 Dim c As Range
 Dim V1 As String, V2 As String, V3 As String
 
 Set Sh = Workbooks("Mlist.xlsm").Worksheets("REMINDERS")
 Set Rng = Sh.Range("A1:A" & Sh.Range("A1000").End(xlUp).Row).SpecialCells(xlCellTypeVisible)
 For Each c In Rng


 If c.Offset(0, 4).Value = "1 Show" Then
 V1 = c
 V2 = c.Offset(0, 1).Value
 V3 = c.Offset(0, 3).Value
 
 With Me.LB1
    .ColumnCount = 3
    .ColumnWidths = "300;100;100"
    .AddItem
    .List(i, 0) = V1
    .List(i, 1) = V2
    .List(i, 2) = V3
    i = i + 1

End With


 'MsgBox V1
 End If
 Next c
 
Upvote 0
Solution

Forum statistics

Threads
1,224,823
Messages
6,181,176
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