Print Macro when not sure what cells to print out

Jewelfine

New Member
Joined
Nov 7, 2002
Messages
35
I have created a macro to format data that gets dumped into excel. Each time it is dumped I don't know how many rows of data there are.

Once the formatting is done I would like it to set the spreadsheet to print only the data that was dumped with the formatting the macro did.

ie Today I want it to print A1 to O25
Tomorrow Print A1 to O300

Is there a way to do this?
Thanx in advance
 
Re: Print Macro when not sure what cells to print

Try

Code:
Sub test()
Dim LR As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
ActiveSheet.PageSetup.PrintArea = "A1:O" & LR
ActiveSheet.PrintOut
End Sub
 
Upvote 0
Re: Print Macro when not sure what cells to print

THanx for the reply
All I seem to get is the title on the page
 
Upvote 0

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