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: 64
Default Print Command - Array of Worksheets

I need some help with printing an array of worksheets in a workbook based on
data in a specific cell.

I have a workbook with 11 worksheets within it. Depending on the
information carried forward to the different worksheets, a formula in cell
G32 will indicate 'Print' or remain blank. What I am trying to accomplish is
a macro that will loop through each of the worksheets and print those that
indicate Print in cell G32.

Following is what I tried to accomplish this:

Sub Print_All_Worksheets_With_Value_In_G32()
Dim Sh As Worksheet
Dim Arr() As String
Dim N As Integer
N = 0
For Each Sh In ActiveWorkbook.Worksheets
If Sh.Visible = xlSheetVisible And Sh.Range("G32").Value < "Print"
Then
N = N + 1
ReDim Preserve Arr(1 To N)
Arr(N) = Sh.Name
End If
Next
With ActiveWorkbook
.Worksheets(Arr).PrintOut
End With
End Sub

However, when I try and run this macro, it stops running and the following
line is highlighted:

If Sh.Visible = xlSheetVisible And Sh.Range("G32").Value < "Print"
Then

Any help to correct this problem would be greatly appreciated
--
Linda
 
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
Print an excel file from command line or "cron" type command ??? Chris Salcedo Excel Programming 2 March 28th 07 01:10 AM
The Print # command print not all rows from excel sheet to file pieros Excel Programming 17 February 22nd 07 03:33 PM
How to format the extension less file to print with Dos's Print Command Badshah Excel Discussion (Misc queries) 0 November 28th 06 12:44 PM
Create command button to print multiple worksheets in a excel file MarcoR Excel Discussion (Misc queries) 3 June 26th 06 07:07 PM
Change Print Command or add a new print command Daniel R. Young Excel Programming 1 November 11th 05 05:14 AM


All times are GMT +1. The time now is 12:36 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"