Macro to Print Active Rows Only

Scottc71

New Member
Joined
May 17, 2010
Messages
9
I have the below Macro that I cannot apply this to a new sheet

can someone please help with this, I have the code below

Sub PrintRefSheet()
'
' Print Install Macro
' Macro recorded 10/05/2011 DMG Communications
'
Application.ScreenUpdating = False
Range("b14").Select
Do Until ActiveCell = "end"
If ActiveCell = 0 Then
ActiveCell.Offset(0, 0).Rows("1:1").EntireRow.Select
Selection.EntireRow.Hidden = True
ActiveCell.Offset(1, 3).Select
End If
If ActiveCell > 0 Then
ActiveCell.Offset(1, 0).Select
End If
Loop
ActiveSheet.PageSetup.PrintArea = "$A$1:$v$99"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
ActiveSheet.PageSetup.PrintArea = "$A$1:$v$99"
Rows("14:94").Select
Selection.EntireRow.Hidden = False
Application.ScreenUpdating = True
Range("A1").Select
End Sub

Thankyou
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
It's not clear what you "want" to do.

This will hide rows where column B (from B14 to B99) =0 and print only the visible rows.

Code:
Sub PrintRefSheet2()

    Range("B13:B99").AutoFilter Field:=1, Criteria1:=">0"
    ActiveSheet.PageSetup.PrintArea = "$A$1:$V$99"
    'ActiveWindow.SelectedSheets.PrintPreview
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
    ActiveSheet.AutoFilterMode = False

End Sub
 
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,850
Members
452,948
Latest member
UsmanAli786

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