Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,670
Default 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??
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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??

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Print Blank Pgs - Preview margins outside print range dsm Excel Discussion (Misc queries) 0 October 25th 06 06:17 PM
Blank Print CD Excel Worksheet Functions 1 August 14th 06 03:31 AM
How to stop print in blank cell? Wind54Surfer Excel Programming 0 February 3rd 06 08:00 PM
If a cell is blank do no let a user print or save? Havenstar Excel Worksheet Functions 12 July 18th 05 06:32 PM
COPY A CONCATENATE CELL TO BLANK CELL PUTTING IN THE NEXT BLANK C. QUEST41067 Excel Discussion (Misc queries) 1 January 15th 05 09:29 PM


All times are GMT +1. The time now is 10:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"