Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Formula/Function for parsing data | Excel Worksheet Functions | |||
Add print function | Excel Worksheet Functions | |||
Print Function | Excel Programming | |||
The SEARCH function and parsing data | Excel Worksheet Functions | |||
before print function | Excel Programming |