Macro for selectiong rows to print

ARIZONA3433

Board Regular
Joined
Dec 8, 2005
Messages
56
Hello all,

Looking through this Qand A board for the last two cay has made my eyes cross. Since I am just learning to write code in vba I have appreciated the help I have received from this board in the past few weeks. If anyone can give some direction it would be apppreciated.

The worksheet details are as follows:

The worksheet is called "Invoice".

Column headings start in B12 through L12.
Data begins in Row 14 and input will be linited to Row 2000.

Row range selection for the user will read:
"Print Row Range 14 To 100"
The number 14, which canvary, is ing cell J6.
The number 100, which canvary, is ing cell L6.

I would like to be able to use selectabe range to select the
Print Area and to show the Print Preview for the user to verify.

Is this possible?

Thanks in advance.
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Something like?
Code:
ActiveSheet.PageSetup.PrintArea = "$B$" & Range("J6") & ":$L$" & Range("L6")
ActiveSheet.PrintPreview

Regards,
 
Upvote 0
Thanks, that worked for selectiong the row to print but I would need the column header and rows 1 through 11 to show on the page.

Possible?
 
Upvote 0
ARIZONA3433 said:
Thanks, that worked for selectiong the row to print but I would need the column header and rows 1 through 11 to show on the page.

Possible?

Code:
With ActiveSheet.PageSetup
    .PrintArea = "$B$" & Range("J6") & ":$L$" & Range("L6")
    .PrintTitleRows = "$1:$11"
End With
ActiveSheet.PrintPreview
 
Upvote 0
Thanks, it worked great. I only had to make one minor change.

Sub PrintArea()

With ActiveSheet.PageSetup
.PrintArea = "$B$" & Range("J6") & ":$L$" & Range("L6")
.PrintTitleRows = "$1:$12"
End With
ActiveSheet.PrintPreview
End Sub
 
Upvote 0
ARIZONA3433 said:
Thanks, it worked great. I only had to make one minor change.

Sub PrintArea()

With ActiveSheet.PageSetup
.PrintArea = "$B$" & Range("J6") & ":$L$" & Range("L6")
.PrintTitleRows = "$1:$12"
End With
ActiveSheet.PrintPreview
End Sub

Hmmm, should have paid a little closer attention. Column header and rows 1 through 11. Haste makes waste. :cool:
 
Upvote 0
I should have explained that the minor change allows for the column headers in row 12 to be printed along with the selected rows.

Thanks again for all your help.
 
Upvote 0

Forum statistics

Threads
1,214,424
Messages
6,119,407
Members
448,894
Latest member
spenstar

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