View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default reference with variables

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?