Thread: Print Code
View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default Print Code

Put this:

Sheets("Commission Pool").PrintOut Copies:=1, Collate:=True

In an If statement like this:

If Sheets("Commission Pool").UsedRange.Cells.Count 1 Then
Sheets("Commission Pool").PrintOut Copies:=1, Collate:=True
End If

If the UsedRange only contains one cell, then it is likely that the rest are
blank.

"Randy" wrote:

And the winner is....Mike H.!!!! lol...just kidding...Thanks a bunch to
everyone who took the time to help me out with this. I really appreciate it!

Now I kind of have one more little question......lets say cells D20:D23
(below) are all empty/blank...how can I "stop" the "Commission Pool" sheet
from printing if "all" cells are blank, but still print even if one of the
cells in the range is "not" blank?

Maybe there is even a better (shorter) way of doing this:

Private Sub Print_All_Click()
ActiveWorkbook.Unprotect Password:="XXXXXX"
Sheets("Commission Pool").PrintOut Copies:=1, Collate:=True
If Not IsEmpty(Sheets("Commission Pool").Range("D20")) Then
Sheets("Sr-Area Manager").Visible = True
Sheets("Sr-Area Manager").PrintOut Copies:=1, Collate:=True
Sheets("Sr-Area Manager").Visible = False
End If
If Not IsEmpty(Sheets("Commission Pool").Range("D21")) Then
Sheets("Community Manager").Visible = True
Sheets("Community Manager").PrintOut Copies:=1, Collate:=True
Sheets("Community Manager").Visible = False
End If
If Not IsEmpty(Sheets("Commission Pool").Range("D22")) Then
Sheets("Assistant Manager").Visible = True
Sheets("Assistant Manager").PrintOut Copies:=1, Collate:=True
Sheets("Assistant Manager").Visible = False
End If
If Not IsEmpty(Sheets("Commission Pool").Range("D23")) Then
Sheets("Leasing Agent (1)").Visible = True
Sheets("Leasing Agent (1)").PrintOut Copies:=1, Collate:=True
Sheets("Leasing Agent (1)").Visible = False
End If
ActiveWorkbook.Protect Password:="XXXXXX"



--
Randy Street
Rancho Cucamonga, CA


"Mike H" wrote:

Randy,

Maybe this. It will print sheet "Commission Pool" with no criteria. Note
I've qualified the D20 name with a sheet name

Private Sub Print_All_Click()
Sheets("Commission Pool").PrintOut Copies:=1, Collate:=True
If Not IsEmpty(Sheets("YourSheet").Range("D20")) Then
Sheets("Sr-Area Manager").PrintOut Copies:=1, Collate:=True
End If
End Sub

Mike

"Randy" wrote:

Greetings...

I have a little code I am needing some assistance with. The code is suppose
to print out certain sheets based on wether a particular cell on another
sheet is empty or not. If the cell is empty the sheet should not print...if
cell is not empty, the sheet should print.

Here is what I have....any assistance will be greatly appreciated!
.................................................. ...............................................
Private Sub Print_All_Click()
Sheets("Commission Pool").PrintOut Copies:=1, Collate:=True
If Not IsEmpty("D20") Then
Sheets("Sr-Area Manager").PrintOut Copies:=1, Collate:=True
Else
Sheets("Sr-Area Manager").PrintOut Copies:=1, Collate:=False
End If
End Sub
.................................................. ...............................................

Thanks again and have a wonderful and safe New Year celebration!
--
Randy Street
Rancho Cucamonga, CA