Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try below
Dim y as Long y = 60 Range("B2:S" & y) If this post helps click Yes --------------- Jacob Skaria "Saladin Andreas" wrote: 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? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Variables in a cell reference | Excel Programming | |||
using variables to reference sheets | Excel Programming | |||
reference variables correctly? | Excel Programming | |||
reference variables correctly? | Excel Programming | |||
Using variables to reference columns in VBA | Excel Programming |