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

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Yogi Anand

MrExcel MVP
Joined
Mar 12, 2002
Messages
11,454
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
 

ROBINSYN

Board Regular
Joined
Aug 19, 2002
Messages
188
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.
 

Yogi Anand

MrExcel MVP
Joined
Mar 12, 2002
Messages
11,454
Hi ROBINSYN:

How about using the UsedRange property ...

ActiveSheet.UsedRange.Select

Does it help?

Regards!

Yogi Anand
 

ROBINSYN

Board Regular
Joined
Aug 19, 2002
Messages
188

ADVERTISEMENT

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
 

Paul B

Well-known Member
Joined
Feb 15, 2002
Messages
575
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?
 

ROBINSYN

Board Regular
Joined
Aug 19, 2002
Messages
188

ADVERTISEMENT

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.
 

Paul B

Well-known Member
Joined
Feb 15, 2002
Messages
575
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
 

ROBINSYN

Board Regular
Joined
Aug 19, 2002
Messages
188
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
 

Forum statistics

Threads
1,143,640
Messages
5,719,987
Members
422,257
Latest member
Calion

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
Top