![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Apr 2002
Posts: 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? |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
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.
__________________
Kind regards, Al Chara |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Apr 2002
Location: Kissimmee, Florida
Posts: 384
|
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
__________________
Hope This Helps. Sean. Digest of Homes WinXP, XL XP |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|