View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Zurn[_54_] Zurn[_54_] is offline
external usenet poster
 
Posts: 1
Default Last Row Variable


sub RangeSelect
dim Ax as integer
dim Ay as integer
dim Bx as integer
dim By as integer

Sheet(" ......").activate
cells (2,1).select
Ax = activecell.column
Ay = activecell.row
selection.End(xltoright).select
Bx = activecell.column
selection.End(xldown).select
By=activecell.row

range(cells(Ay, Ax),cells(By,Bx)).select
selection.copy

end sub
_____________________________________
Sub PrintSetup

dim PrintStr as string

---same code as above ----

PrintStr = "$A$" & Ay & ":$R$" & By

Activesheet.pagesetup.Printarea = PrintStr

end sub



I did not try it, but should be more or less like this

Ciao


--
Zurn
------------------------------------------------------------------------
Zurn's Profile: http://www.excelforum.com/member.php...o&userid=14645
View this thread: http://www.excelforum.com/showthread...hreadid=536706