marco to Print range until blank cells

biffothebear0

New Member
Joined
Apr 3, 2008
Messages
10
Help Please,

I need a macro to print a range, IE: columns A:J but the number of rows will always change as I do not know how much data there will be between these rows. I need a macro to print a set print area until there are blank cells arcoss each column, thus printing out all the required data

please can someone help
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Try

Code:
Sub prt()
Dim LR As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
With ActiveSheet
    .PageSetup.PrintArea = "A1:J" & LR
    .PrintOut
End With
End Sub
 
Upvote 0
Hi

This doesn't work, all it does it print out the first two lines on the spreadsheet and ignores the rest of the data below.

thanks
 
Upvote 0
Then maybe

Code:
Sub prt()
Dim LR As Long
With ActiveSheet
    LR = .Cells.Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row
    .PageSetup.PrintArea = "A1:J" & LR
    .PrintOut
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,606
Messages
6,179,865
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