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: 10
Default Print function parsing help



Hi.

I have a macro that tests a cell in each sheet of a workbook, then
prints only those sheets that have the right data in that cell. The
problem is that the macro tests a sheet, then prints it, then tests the
next, etc.

I need it to make the tests, compile what sheets need to be printed,
and make a single print job.

I was attempting to use 'worksheets.Array().select' and put the test
data in the array for which sheets to activate for a print session.

I think it might be better to copy the sheets that pass the test to
another (temporary) workbook, and then simple print that entire workbook
to achieve my needed result.

AmI moving in the right direction?

Code follows...

Sub selprint()
Dim i As Integer
Dim currentsheet As Worksheet

For i = 1 To ActiveWorkbook.Worksheets.Count
Set currentsheet = ActiveWorkbook.Worksheets(i)
Worksheets(i).Activate
'Skip empty sheets and hidden sheets
If Application.CountA(currentsheet.Cells) < 0 And currentsheet.Visible
Then
'change the hard-coded cell here if not F52
If (Not IsNull(Range("F52"))) And (Range("F52").Value < 0) Then
'un-comment the next line when debugging completed
ActiveSheet.PrintOut
'add comment at start of next line when debugging completed
' ActiveSheet.PrintPreview
End If
End If
Next i
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
Formula/Function for parsing data Nadine Excel Worksheet Functions 5 April 1st 10 08:46 PM
Add print function Tim Excel Worksheet Functions 4 January 2nd 09 05:15 PM
Print Function EMoe[_78_] Excel Programming 2 November 27th 05 08:56 PM
The SEARCH function and parsing data Michael Excel Worksheet Functions 2 September 19th 05 05:36 PM
before print function lawson Excel Programming 3 February 22nd 05 04:34 PM


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