Printing help

Graham JN

New Member
Joined
Apr 15, 2018
Messages
13
HI

Can any one save me !!

I have a sheet which populates with information (the info that populates changes in the number of rows but the columns are generally set

I would like a VBA which

Specifies the fix columns for printing for example column B to F

I would like it to specify the first row the printing starts from for example row 6

Then I would like it to only print down to the row of a specific column C, it stops at the print range at which there is nothing in the cell


So my variables are it only ever prints the column range B to F

It starts printing at row 6

Then it stops printing when there is no data (the cell is empty in column C) for example C56 (however 56 variable depending on cell content)

That makes my print range on this sheet become
B6:F6
B56:F56



Someone make me happy
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Is this what you are after?
Code:
Sub SetPrintArea()

    Dim lr As Long
    
'   Find last row in column C withdata
    lr = Cells(Rows.Count, "C").End(xlUp).Row
    
'   Set print area
    ActiveSheet.PageSetup.PrintArea = "B6:F" & lr
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

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