reference with variables

  • Thread starter Thread starter Saladin Andreas
  • Start date Start date
S

Saladin Andreas

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?
 
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))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top