Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default List box to create array

Hi, I've read through the board and don't see anything that addresses a
problem I'm stuck on. I've embedded a list box that allows multiple
selections in a worksheet. I have a button tied to a macro that executes a
print command, and I'd like to use the selections from the list box to create
a Sheets Array that I can then use in the print macro to print the specified
selections (which equate to individual worksheets in the file). Any help
greatly appreciated!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default List box to create array


Dim i As Long

With Me.ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) Then

Worksheets(i).PrintOut
End If
Next i
End With


--
__________________________________
HTH

Bob

"Nick O" wrote in message
...
Hi, I've read through the board and don't see anything that addresses a
problem I'm stuck on. I've embedded a list box that allows multiple
selections in a worksheet. I have a button tied to a macro that executes
a
print command, and I'd like to use the selections from the list box to
create
a Sheets Array that I can then use in the print macro to print the
specified
selections (which equate to individual worksheets in the file). Any help
greatly appreciated!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default List box to create array

Ooookay. I see how this would work, but what I failed to mention is that the
printout consists of sheets that are always printed in addition to the sheets
selected, and it all prints as one package (right now I use a Sheets Array
command to specify the all the sheets but was looking to use a list box to
subsitute the optional sheets). So in the end I need to create something
that allows me to combine a fixed set of sheet names with the selected sheets
from the list box and execute a print on the entire package simultaneously.
Does that make sense?

"Bob Phillips" wrote:


Dim i As Long

With Me.ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) Then

Worksheets(i).PrintOut
End If
Next i
End With


--
__________________________________
HTH

Bob

"Nick O" wrote in message
...
Hi, I've read through the board and don't see anything that addresses a
problem I'm stuck on. I've embedded a list box that allows multiple
selections in a worksheet. I have a button tied to a macro that executes
a
print command, and I'd like to use the selections from the list box to
create
a Sheets Array that I can then use in the print macro to print the
specified
selections (which equate to individual worksheets in the file). Any help
greatly appreciated!




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default List box to create array

Assuming you have an array of sheets, append to it with

Dim i As Long

With Me.ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) Then

Redim Preserve arySheets(LBound(arySheets) To
UBound(arySheets))
arySheets(UBound(arySheets)) = .List(i)
End If
Next i
End With

Worksheets(arySheets).Printout

--
__________________________________
HTH

Bob

"Nick O" wrote in message
...
Ooookay. I see how this would work, but what I failed to mention is that
the
printout consists of sheets that are always printed in addition to the
sheets
selected, and it all prints as one package (right now I use a Sheets Array
command to specify the all the sheets but was looking to use a list box to
subsitute the optional sheets). So in the end I need to create something
that allows me to combine a fixed set of sheet names with the selected
sheets
from the list box and execute a print on the entire package
simultaneously.
Does that make sense?

"Bob Phillips" wrote:


Dim i As Long

With Me.ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) Then

Worksheets(i).PrintOut
End If
Next i
End With


--
__________________________________
HTH

Bob

"Nick O" wrote in message
...
Hi, I've read through the board and don't see anything that addresses a
problem I'm stuck on. I've embedded a list box that allows multiple
selections in a worksheet. I have a button tied to a macro that
executes
a
print command, and I'd like to use the selections from the list box to
create
a Sheets Array that I can then use in the print macro to print the
specified
selections (which equate to individual worksheets in the file). Any
help
greatly appreciated!






Reply
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
Create a List Output from a Horizontal Array Input Rob Excel Worksheet Functions 4 September 17th 09 05:40 PM
Create an ordered list from 2d array MarkBrazier Excel Worksheet Functions 6 August 3rd 09 04:22 PM
array formula to extract members of list A that are not in list B [email protected] Excel Programming 5 February 12th 08 09:50 PM
Array Formulas - Unique List from List with Duplicates Johnny Meredith Excel Discussion (Misc queries) 7 October 27th 06 09:26 PM
How to create adress list so can mail merge and create labels? adecocq Excel Discussion (Misc queries) 2 October 25th 06 12:32 AM


All times are GMT +1. The time now is 06:55 PM.

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

About Us

"It's about Microsoft Excel"