Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
refer to cell
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! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
refer to cell
Hi Anne,
Your question is not clear but, perhaps, try something like: '============= Public Sub Tester() Dim x As Long, y As Long x = 6 y = 4 ThisWorkbook.Names.Add Name:="CorrMatrix", _ RefersTo:=Range("A1").Resize(x, y).Address End Sub '<<============= --- Regards, Norman "Arne Hegefors" wrote in message ... 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! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
refer to cell
Your RefersTo doesn't reference the sheet you are using. It should be
something like "=Sheet1!$A$1:$C$10" HTH, Barb Reinhardt "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! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
sql that will refer to a cell in excel | Excel Programming | |||
Refer a specific cell in a named cell range | Excel Programming | |||
How make hyperlink refer to cell content rather than cell address. | Excel Discussion (Misc queries) | |||
How to refer to every 5 th cell? | Excel Discussion (Misc queries) | |||
refer cell using c | Excel Programming |