I want to print a sheet with the upper left point being A1 with the bottom
right point variable. I could put a word in the cell (i.e. corner), I need
a macro to look through the sheet and find the word "corner" this would then
be used as the bottom right point for the print setup. Any ideas?
David - 01 Jun 2005 19:40 GMT
Hi,
Try this, hope it helps.
Sub Corner1()
Cells.Find(What:="corner", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
Corner = ActiveCell.Address
ActiveSheet.PageSetup.PrintArea = "$A$1:" & Corner
End Sub
Thanks,
> I want to print a sheet with the upper left point being A1 with the bottom
> right point variable. I could put a word in the cell (i.e. corner), I need
> a macro to look through the sheet and find the word "corner" this would then
> be used as the bottom right point for the print setup. Any ideas?
Paul H - 01 Jun 2005 20:04 GMT
David, thanks, it works great.
Paul
> Hi,
> Try this, hope it helps.
[quoted text clipped - 12 lines]
> > a macro to look through the sheet and find the word "corner" this would then
> > be used as the bottom right point for the print setup. Any ideas?
Tom Ogilvy - 01 Jun 2005 19:43 GMT
With Activesheet
set rng = .Cells.Find("corner")
if not rng is nothing then
.PageSetup.PrintArea = _
.Range(.Range("A1"),rng).Address(external:=True)
End if
End With

Signature
Regards,
Tom Ogilvy
> I want to print a sheet with the upper left point being A1 with the bottom
> right point variable. I could put a word in the cell (i.e. corner), I need
> a macro to look through the sheet and find the word "corner" this would then
> be used as the bottom right point for the print setup. Any ideas?
Don Guillett - 01 Jun 2005 19:49 GMT
If that's really what you want to do
Sub printrng()
Range("a1:" & Cells.Find("corner").Address).PrintPreview
End Sub

Signature
Don Guillett
SalesAid Software
donaldb@281.com
> I want to print a sheet with the upper left point being A1 with the bottom
> right point variable. I could put a word in the cell (i.e. corner), I need
> a macro to look through the sheet and find the word "corner" this would then
> be used as the bottom right point for the print setup. Any ideas?
Latebloomer - 26 Jun 2006 17:33 GMT
Hi
This macro is exactly what I need also, except it's not working-- because I
have an "ifand" formula in cells to return the value "corner".
The macro is setting the end of the print range at the first cell it sees
the formula, not the returned value "corner"
How do I tweak this?
> If that's really what you want to do
>
[quoted text clipped - 8 lines]
> then
> > be used as the bottom right point for the print setup. Any ideas?