Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,670
Default "pre-specify" print options

Is there a way to setup the print button to check a cell for a non-blank
status in each sheet of a workbook and have that sheet print based on the
status of the cell? Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 132
Default "pre-specify" print options

This code looks at all the worksheets to see if the value in A1 is true and
prints those sheets.

Regards,
Bill


Public Sub PrintSelectSheets_Variable()
Dim wkb As Workbook
Dim strSheets() As String
Dim lngFound As Long
Dim i As Long

Set wkb = ThisWorkbook
lngFound = -1

' Put all the sheets to print into the strSheets array
ReDim strSheets(0 To wkb.Sheets.Count - 1) As String

For i = 0 To wkb.Sheets.Count - 1
If (wkb.Sheets(i + 1).Range("A1").Value = True) Then
lngFound = lngFound + 1
strSheets(lngFound) = wkb.Sheets(i + 1).Name
End If
Next i

ReDim Preserve strSheets(0 To lngFound) As String

wkb.Sheets(strSheets).Printout

End Sub



"Eric" wrote:

Is there a way to setup the print button to check a cell for a non-blank
status in each sheet of a workbook and have that sheet print based on the
status of the cell? Thanks!

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
EXCEL allow 2 options on status bar e.g. show "Count" + "Sum" LEJM Excel Discussion (Misc queries) 2 November 15th 07 07:49 PM
"Save" and "Save As" options greyed out - "Save as Webpage" option Bill Excel Discussion (Misc queries) 0 January 16th 07 04:47 PM
Shortcut key for "Paste Options" and "Error Checking" buttons? johndog Excel Discussion (Misc queries) 1 October 6th 06 11:56 AM
Debug.Print "Test " vbCodeLineNumber & ": " & varName TommySzalapski[_32_] Excel Programming 1 August 2nd 05 05:17 PM
What are the System Tables named "Print Area" & "Print Titles"? Tom Ogilvy Excel Programming 1 August 18th 03 05:38 PM


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