ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Range reference (https://www.excelbanter.com/excel-programming/391149-range-reference.html)

Arne Hegefors

Range reference
 
Hi! In my macro I have a named range. I want to refer to a certain cell
within the range (eg the one in the left corner). However I have some trouble
with the syntax.

ThisWorkbook.Names.Add Name:="FactorCorrRange", _
RefersTo:="=$i$1:$j$5", Visible:=True
var = FactorCorrRange.Offset(1, 1).Text

the program says Error 424 object required. Can someone pls help me? Thanks!



Vergel Adriano

Range reference
 
Arne,

try it this way:

ThisWorkbook.Names.Add Name:="FactorCorrRange", _
RefersTo:="=$i$1:$j$5", Visible:=True
Var = Range("FactorCorrRange").Cells(1, 1).Value


--
Hope that helps.

Vergel Adriano


"Arne Hegefors" wrote:

Hi! In my macro I have a named range. I want to refer to a certain cell
within the range (eg the one in the left corner). However I have some trouble
with the syntax.

ThisWorkbook.Names.Add Name:="FactorCorrRange", _
RefersTo:="=$i$1:$j$5", Visible:=True
var = FactorCorrRange.Offset(1, 1).Text

the program says Error 424 object required. Can someone pls help me? Thanks!



Tom Ogilvy

Range reference
 
Activesheet.Range("i1:j5").Name = "FactorCorrRange"
var = Range("FactorCorrRange")(1).value

--
Regards,
Tom Ogilvy


"Arne Hegefors" wrote:

Hi! In my macro I have a named range. I want to refer to a certain cell
within the range (eg the one in the left corner). However I have some trouble
with the syntax.

ThisWorkbook.Names.Add Name:="FactorCorrRange", _
RefersTo:="=$i$1:$j$5", Visible:=True
var = FactorCorrRange.Offset(1, 1).Text

the program says Error 424 object required. Can someone pls help me? Thanks!




All times are GMT +1. The time now is 06:38 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com