Thread: Printing
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
ozgrid.com ozgrid.com is offline
external usenet poster
 
Posts: 464
Default Printing

Hi Steve

Try something along the lines of;

Sub PrintIf()
Dim rRow As Range

Set rRow = Sheet1.Rows(7)
'http://www.ozgrid.com/VBA/excel-vba-sheet-names.htm

If WorksheetFunction.CountBlank(rRow) = Sheet1.Columns.Count Then
Exit Sub
Else
'YOUR PRINT CODE
End If
End Sub



--
Regards
Dave Hawley
www.ozgrid.com
"stevestr" wrote in message
...
Hello Brilliant Excel Users,

I have a macro that prints out sheets in my workbook but I want it to be
smarter about printing. For example, I have programmed my macro to filter
the data on one of my sheets and print two copies of that sheet. If the
filter turns up no rows of data, then there's no need to print that sheet.

How do I have program the macro to look at row 7 (the first row of data),
determine if it's blank and if it's blank, skip the printing command and
continue with the rest of the macro?

I know it's really simple but I can't figure out the If/Then programming.

Thanks,

Steve