ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Print only if Cell is non-blank (https://www.excelbanter.com/excel-programming/373730-print-only-if-cell-non-blank.html)

Eric

Print only if Cell is non-blank
 
I am getting an "out-of-range" error on this code:

Private Sub PrintButton1_Click()

If IsEmpty(Worksheets("Sheet1").Range("A8").Value) Then
Worksheets("Sheet1").PrintOut Copies:=1
End If

End Sub

I have a command button set up such that when clicked, the code should check
a certain cell on each sheet of a workbook and print the sheets that have
some value in that cell. Any ideas??

Tom Ogilvy

Print only if Cell is non-blank
 
subscript out of range for the following code would be an indication the
sheet is not named exactly "Sheet1". There may be a space somewhere in the
name as an example.

--
Regards,
Tom Ogilvy


"Eric" wrote:

I am getting an "out-of-range" error on this code:

Private Sub PrintButton1_Click()

If IsEmpty(Worksheets("Sheet1").Range("A8").Value) Then
Worksheets("Sheet1").PrintOut Copies:=1
End If

End Sub

I have a command button set up such that when clicked, the code should check
a certain cell on each sheet of a workbook and print the sheets that have
some value in that cell. Any ideas??



All times are GMT +1. The time now is 11:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com