Solved!!!Print only rows with data

ROBINSYN

Board Regular
Joined
Aug 19, 2002
Messages
188
How do I set a sheet to print via macro but only print say Sheet 7, Range A1:Q1500 if cells contain data. Empty cells should not be printed.
This message was edited by ROBINSYN on 2002-10-27 22:00
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Hi ROBINSYN:

If you are referring to printing only those rows that have data, you might be able to make use of AutoFilter the range for NonBlanks -- this way pulling all your rows with data together -- and then PRINT

I hope this helps.

Regards!

Yogi Anand
 
Upvote 0
All the rows are already together. It is the Database sheet. It is going to expand through the year. I need the macro to find last row containing an entry and print to that range. As the year goes on the list will grow.
Users are very computer non friendly and this would save me alot of explaining as I have to distrbute this to numerous schools in Nunavut.
 
Upvote 0
Hi ROBINSYN:

How about using the UsedRange property ...

ActiveSheet.UsedRange.Select

Does it help?

Regards!

Yogi Anand
 
Upvote 0
Tried this and thought I had it, NOT! Can anyone see what's wrong here. Any used cells in Column "A" contain a custom number

EI: 59-IQ-1, 59-IQ-2, 59-IQ-3, ...
Could that be the problem.
Macro Prints but all formated cells. I need the column formated.


Sub PrintSummary()

' PrintSummary Macro
' Macro by Cindy Robinson
Dim LastRow As Long
If WorksheetFunction.CountA(Cells) > 0 Then

LastRow = Cells.Find(What:="*", After:=[A1], _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
ActiveSheet.UsedRange.Select
ActiveSheet.PageSetup.PrintArea = UsedRange
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=False

End If

End Sub
 
Upvote 0
ROBINSYN, Are you wanting to print rows based on data in a specific column? Like if column A has data, print the rows, if not don’t print the rows?
 
Upvote 0
yes, that's it. Column A I have consectutive numbers. If colum A contains data then colums B through Q do too.
It seems poinless to print blank sheets of boxes so I was hoping it was possible to print rows with data from A:Q.
 
Upvote 0
ROBINSYN, this sub, by Tom Urtis was given in one of your other post for a question asked by ac, I thought it might be useful some day so I made a copy of it

Sub PrintA()
'prints rows of data, will not print rows if column A is blank
Application.ScreenUpdating = False
Range("A:A").EntireRow.Hidden = False
Range("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Hidden = True
ActiveWindow.SelectedSheets.PrintOut Copies:=1
Range("A:A").EntireRow.Hidden = False
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Thank you Paul. I came up with this one. I'll try both and see which takes less time.

Sub PrintSummary()
Dim myrange As String
myrange = Cells(Rows.Count, 17).End(xlUp).Address
ActiveSheet.PageSetup.PrintArea = "$A$1:" & myrange
Application.Goto Reference:="R1C1"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=False
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,429
Members
448,961
Latest member
nzskater

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top