LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 82
Default Can't get a value out of a list box

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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparing List A to List B and add what's missing from List B Gilbert Excel Discussion (Misc queries) 2 July 20th 09 11:18 PM
create new list from list A, but with exclusions from a list B Harold Good Excel Worksheet Functions 3 April 11th 08 11:23 PM
validation list--list depends on the selection of first list Michael New Users to Excel 2 April 27th 06 10:23 PM
list 1 has 400 names List 2 has 4000. find manes from list 1 on 2 Ed Excel Worksheet Functions 5 September 12th 05 09:48 AM
find names on list 1 in list 2. list 1 4000 names list 2 400 name Ed Excel Worksheet Functions 1 September 4th 05 12:48 AM


All times are GMT +1. The time now is 05:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"