Loop through values in a combobox
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
"Bob Phillips" wrote:
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)
"rael_lucid" wrote in message
...
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
|