Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / February 2008

Tip: Looking for answers? Try searching our database.

print macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
David - 25 Jan 2008 00:58 GMT
Hello

I have a workbook that has around 18 worksheets in it. Is there a macro
when clicking on the print button that only the pages with data entered
prints out.

Right now I have to print each page one at a time or print the whole
workbook even though some sheets don't have data entered.

TIA
David
Don Guillett - 25 Jan 2008 01:05 GMT
Sheets that have NO data do not print. Try this for testing

Sub printif()
For i = 1 To Sheets.Count
Sheets(i).PrintPreview
Next i
End Sub

Signature

Don Guillett
Microsoft MVP Excel
SalesAid Software
dguillett1@austin.rr.com

> Hello
>
[quoted text clipped - 7 lines]
> TIA
> David
David - 19 Feb 2008 14:06 GMT
Thanks Don but, how does this determine what worksheet has been filled in or
not? My worksheets are kind of like forms where the user answers questions.
Not all sheets get answered but there are still questions on them. I want to
create a macro that prints all pages with answers on them.

Thank you

David

> Sheets that have NO data do not print. Try this for testing
>
[quoted text clipped - 15 lines]
> > TIA
> > David
Dave Peterson - 19 Feb 2008 15:16 GMT
Is there a cell on each sheet that must be completed?

Is it always the same address?

If no to either of these, what would you look at for each sheet to determine if
it should be printed?

> Thanks Don but, how does this determine what worksheet has been filled in or
> not? My worksheets are kind of like forms where the user answers questions.
[quoted text clipped - 29 lines]
> > > TIA
> > > David

Signature

Dave Peterson

Don Guillett - 19 Feb 2008 16:24 GMT
Tests each sheet to see if cell a1 is not empty

Sub printif()
For i = 1 To Sheets.Count
 With Sheets(i)
  If Not IsEmpty(.Range("a1")) Then
    .PrintPreview
  End If
 End With
Next i
End Sub

Signature

Don Guillett
Microsoft MVP Excel
SalesAid Software
dguillett1@austin.rr.com

> Thanks Don but, how does this determine what worksheet has been filled in
> or
[quoted text clipped - 27 lines]
>> > TIA
>> > David
David - 19 Feb 2008 19:24 GMT
Excellent Thank you both

> Tests each sheet to see if cell a1 is not empty
>
[quoted text clipped - 39 lines]
> >> > TIA
> >> > David
Don Guillett - 19 Feb 2008 19:50 GMT
Glad to help

Signature

Don Guillett
Microsoft MVP Excel
SalesAid Software
dguillett1@austin.rr.com

> Excellent Thank you both
>
[quoted text clipped - 45 lines]
>> >> > TIA
>> >> > David
David - 20 Feb 2008 00:40 GMT
Hello Don

I went through the whole workbook and made it so that j8 is the common cell.
I put the code you suggested in the Thisworkbook section but replaced the a1
with j8. I made a button on the first sheet that runs this macro but get a
error box with a 400 in it. Any ideas?

Thanks again

> Tests each sheet to see if cell a1 is not empty
>
[quoted text clipped - 39 lines]
> >> > TIA
> >> > David
Don Guillett - 20 Feb 2008 12:39 GMT
I just re-tested successfully. What else did you change in the macro? You
should have just copied and pasted and only changed a1 to j8. Or, did you
re-write and forget the dots before .range and .printpreview? Post your code
or send me your workbook to the address below.

Signature

Don Guillett
Microsoft MVP Excel
SalesAid Software
dguillett1@austin.rr.com

> Hello Don
>
[quoted text clipped - 54 lines]
>> >> > TIA
>> >> > David
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.