J
JonR
Hi
I have a userform that allows users to select and print various objects. I
am trying to incorporate a listbox that allows the user to select the number
of copies desired.
I can populate the listbox fairly easily, but when I try to run the print
program (or even a test MsgBox) I get an error stating that the value of the
variable nCopies is null.
How do I set this up so that the variable nCopies gets its value from the
list box?
Example code is below; the real deal jumps around a bit between several
different subs.
sub load ()
' populates the list box
Dim num As Integer
For num = 1 To 25
Form1.ListBox1.AddItem (num)
Next
end sub
sub printcopy ()
Dim nCopies as Integer
nCopies = Form1.ListBox1.Value
for i= 1 to nCopies
ActiveSheet.PrintOut
next
end sub
I have a userform that allows users to select and print various objects. I
am trying to incorporate a listbox that allows the user to select the number
of copies desired.
I can populate the listbox fairly easily, but when I try to run the print
program (or even a test MsgBox) I get an error stating that the value of the
variable nCopies is null.
How do I set this up so that the variable nCopies gets its value from the
list box?
Example code is below; the real deal jumps around a bit between several
different subs.
sub load ()
' populates the list box
Dim num As Integer
For num = 1 To 25
Form1.ListBox1.AddItem (num)
Next
end sub
sub printcopy ()
Dim nCopies as Integer
nCopies = Form1.ListBox1.Value
for i= 1 to nCopies
ActiveSheet.PrintOut
next
end sub