Worksheet printing

  • Thread starter Thread starter Colin Telfer
  • Start date Start date
C

Colin Telfer

Does anyone have any routines available which will allow one to print off
worksheets in a spreadsheet which have entries in them, e.g. worksheets 1,
4, and 5 will have data in whereas 2 and 3 are empty?

Thanks in advance

Colin
 
Colin
The code would have to have a means of determining that a sheet is empty
or not empty. This can be done by various means, some easier than others.
Is there some clue (this cell has an entry or that range has some entries,
etc.) that the code can use to make this determination? The code can even
be written to make this determination without any clues at all, if
necessary.
Basically, the code would be a For loop through all the sheets in the
workbook, then determine which ones to print by the clues you furnish, print
it (or not) and then go to the next sheet. Post back with a bit more detail
about what you have. HTH Otto
 
Hi Colin,

The following code should perform the test you want.

Sub Test_Used_Area()

Dim rng1 As Range
Dim ws As Worksheet

For Each ws In Sheets
ws.Select
Set rng1 = ws.UsedRange

If rng1.Cells.Count = 1 And rng1.Cells(1, 1) = Empty Then
MsgBox ws.Name & " is empty"
Else
MsgBox ws.Name & " is not empty"
End If

Next ws
End Sub

Regards,

OssieMac
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top