我正在编写 VBA 代码来用相同的数据填充三个不同的组合框。我只是想知道是否有比我现在正在做的更有效的编写方式?
' 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
感谢您抽出宝贵的时间!