PC Review


Reply
Thread Tools Rate Thread

any suggestions welcomed

 
 
jonny
Guest
Posts: n/a
 
      10th Feb 2004
re 8:10 am

how do you go about populating an array one by one? I'm
assuming I could check each of the 160 sheets and if one
needs printing, put the sheet no. into the array and
print the sheets(array).printout function

maybe

 
Reply With Quote
 
 
 
 
Auric__
Guest
Posts: n/a
 
      10th Feb 2004
"...And the next sign of the Apocalypse will be..."
*****
On Tue, 10 Feb 2004 08:32:33 -0800, jonny wrote:

>re 8:10 am
>
>how do you go about populating an array one by one? I'm
>assuming I could check each of the 160 sheets and if one
>needs printing, put the sheet no. into the array and
>print the sheets(array).printout function
>
>maybe


Here's two different ideas I had, which I did before seeing your second
post. This works on my computer with Sheets.Count=4.
Sub foo()
ReDim printThese(1 To Sheets.Count) As Boolean
For x = 1 To Sheets.Count
If Sheets(x).Cells(1, 3).Value = "printable" Then
printThese(x) = True
Next
For x = 1 To UBound(printThese)
If printThese(x) Then Sheets(x).PrintOut
Next
End Sub

Here's an alternate version I tried - it *doesn't* work but I think it
would be a trivial matter to fix. I'm not going to; I'm going to sleep.
Sub bar()
ReDim printThese(0) As Integer '0 is unused in this example
For x = 1 To 4
If Sheets(x).Cells(1, 3).Value = "printable" Then
ReDim printThese(UBound(printThese) + 1)
printThese(UBound(printThese)) = x
End If
Next
For x = 1 To UBound(printThese)
'subscript out of range on x=1 - shrug
Sheets(printThese(x)).PrintOut
Next
End Sub

--
auric "underscore" "underscore" "at" hotmail "dot" com
*****
Racial characteristics: violently loud alcoholic rednecks.
 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      10th Feb 2004
Why do you want them in a Array?

You can loop and print the sheets one by one

Sub test()
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
If sh.Range("C1").Value = "printable" Then sh.PrintOut
Next sh
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"jonny" <(E-Mail Removed)> wrote in message news:d79501c3eff3$7c3c64d0$(E-Mail Removed)...
> re 8:10 am
>
> how do you go about populating an array one by one? I'm
> assuming I could check each of the 160 sheets and if one
> needs printing, put the sheet no. into the array and
> print the sheets(array).printout function
>
> maybe
>



 
Reply With Quote
 
Dick Kusleika
Guest
Posts: n/a
 
      10th Feb 2004
jonny

Here's an example

Sub test()

Dim arrSheets() As String
Dim Sh As Worksheet
Dim i As Long

i = 1

For Each Sh In ThisWorkbook.Worksheets
If Sh.Range("A1").Value = 1 Then
ReDim Preserve arrSheets(1 To i)
arrSheets(i) = Sh.Name
i = i + 1
End If
Next Sh

ThisWorkbook.Sheets(arrSheets).PrintOut

End Sub

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"jonny" <(E-Mail Removed)> wrote in message
news:d79501c3eff3$7c3c64d0$(E-Mail Removed)...
> re 8:10 am
>
> how do you go about populating an array one by one? I'm
> assuming I could check each of the 160 sheets and if one
> needs printing, put the sheet no. into the array and
> print the sheets(array).printout function
>
> maybe
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
any ideas welcomed jasonb General 1 28th Feb 2010 07:34 PM
Another welcomed member Thermaltke Introductions 6 4th Nov 2004 01:47 PM
Any ideas welcomed. rainbow Windows XP Performance 4 31st Jul 2004 08:22 PM
any suggestions welcomed jonny Microsoft Excel Programming 0 10th Feb 2004 04:10 PM
OC'ing P4P800Dlx; Curious Results, Suggestions Welcomed! Ken Fox Asus Motherboards 12 5th Jan 2004 05:27 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:53 AM.