View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Patrick Molloy Patrick Molloy is offline
external usenet poster
 
Posts: 1,049
Default reference with variables

Jacob shows one way

instead of RANGE(), you could use CELLS()

dim rw1 as long
dim cl1 as string
dim rw2 as long
dim cl2 as string

rw1=2
cl1="B" ' or 2 with cl1 DIM as a LONG
rw2=60
cl2="S" ' or 19 with cl2 DIM as a LONG

Range(Cells(rw1.cl1),Cells(rw2,cl2))

"Saladin Andreas" wrote in
message ...
range (e.g. for printarea selection) is normally noted like e.g.: "B2:S60"
Instead of the numbers I would like to use variables to replace numbers
e.g.
integer variable.

It does not work to do it this way "B2:Sy"
nor this way "B2:S"y""

It seems that there has to be a letter and a number as reference

How to solve this?