Multiple "With" commands - Please help

  • Thread starter Thread starter Azza
  • Start date Start date
A

Azza

HELP

I have a screen full of comboboxes and when I initiate the form I want
to populate the drop downs.
I want to populate many of them with the same info but cannot work out
the WITH commands to populate many boxes with the same info.

i.e. With cboxDay1,cboxDay2
.add ("1")
.add ("2")
End With

- This command does not work

Please help
 
You could loop through all the comboboxes and set each individually, or you
could just set one and "copy" to the others.

I put 6 comboboxes (cboxday1 through cboxday6) on a worksheet:

Dim iCtr As Long
With Worksheets("sheet1")
With .OLEObjects("cboxday1").Object
.Clear
.AddItem 1
.AddItem 2
.AddItem 3
End With
For iCtr = 2 To 6
.OLEObjects("cboxday" & iCtr).Object.List _
= .OLEObjects("cboxday1").Object.List
Next iCtr
End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top