Loop through values in a combobox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a spreadsheet which has a combobox and a table of data below it. When
a value in the combobox is selected, the data below changes. I would like to
write a routine that basically selects each value in the combobox and then
prints the page.

So, something like:

For Each <variable> in <Combobox>
ActiveWorkbook.PrintOut From:=1, To:=1, Copies:=1, Collate:=True
Next <variable>

Is this possible?
If the combo box has 100 items, do I run the risk of crashing the PC, or
printer?
Is there a better way?

Rael
 
Presumably the combobox is sourced from some other data? You could always
loop through that data.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
Bob,

Have converted the Combobox to a Listbox and used the following code:

Dim iCount As Long

With Me.lstCentres
For iCount = 0 To .ListCount - 1
.Selected(iCount) = True
If iCount > 0 Then .Selected(iCount - 1) = False
Application.DisplayAlerts = False
ActiveWorkbook.PrintOut From:=1, To:=2, Copies:=1, Collate:=True
Application.DisplayAlerts = True
Next iCount
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