View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] paul.robinson@it-tallaght.ie is offline
external usenet poster
 
Posts: 789
Default refer to cell

Hi
Try
Range("A1").Resize(x,x).Name = "CorrMatrix"

The Refers To technique is diffcult to use for variable ranges.
regards
Paul

On May 23, 9:13 am, Arne Hegefors
wrote:
Hi! I want to name a range in VBA. I know in what cell I want it to start,
lets say A1. I also have a variable that controls both the height and length
of the range (they are of equal size). This variable is called x.

I have:

ThisWorkbook.Names.Add Name:="CorrMatrix", RefersTo:="=$A$1:$C$10",
Visible:=True

but the Refers to bit is wrong. How shall I write it? please help!