Quicker way of writing for each statement in VBA

excel, vba

Solution

One step further, possibly:

dim lLoop as long
' Create fac1 cbo
For Each c_fac In ws_misc.Range("fac")
    For lLoop=1 to 3
        Me.controls("cbo_fac" & lLoop).AddItem c_fac.Value
        Me.controls("cbo_fac" & lLoop).List(Me.controls("cbo_fac" & lLoop).ListCount - 1, 1) = c_fac.Offset(0, 1).Value
    next lLoop
Next c_fac

Problem

I'm writing VBA code to fill three different combo-boxes with the same data. I was just wondering if there is a more efficient way of writing it then what I am doing at the moment? ``` ' Create fac1 cbo For Each c_fac In ws_misc.Range("fac") With Me.cbo_fac1 .AddItem c_fac.Value .List(.ListCount - 1, 1) = c_fac.Offset(0, 1).Value End With Next c_fac ' Create fac2 cbo For Each c_fac In ws_misc.Range("fac") With Me.cbo_fac2 .AddItem c_fac.Value .List(.ListCount - 1, 1) = c_fac.Offset(0, 1).Value End With Next c_fac ' Create fac3 cbo For Each c_fac In ws_misc.Range("fac") With Me.cbo_fac3 .AddItem c_fac.Value .List(.ListCount - 1, 1) = c_fac.Offset(0, 1).Value End With Next c_fac ``` Thanks for taking the time!

Original source