Setting a print range in a formula

chadm

New Member
Joined
Apr 14, 2002
Messages
45
Is there a way to set a print range via a formula?

I want the print range to end where a cell = 99.

Any ideas?
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
I'm heading home now but try the following procedure:

Do a FIND for "99" inside a loop (Do, if, for)

Then use the ADDRESS to find where the 99 is located.

Then setup your PRINTAREA with PAGESETUP.

Post with any more questions, someone on here will answer.
 
Upvote 0
You can do this using a simple macro, The one I have written assumes that you want it to print from cell A1 to the occurence of "99" in the sheet.

Sub SetPrtRng()
Cells.Select
Selection.Find(What:="99", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False).Activate
Rng = "A1:" & ActiveCell.Address
ActiveSheet.PageSetup.PrintArea = Rng
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,489
Messages
6,113,947
Members
448,534
Latest member
benefuexx

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