A
Adrian
I have large system of workbooks and sheets. At start up a
macro reads a set of configuring constants from a sheet
and installs them as names. The code that does that is
below.
Trouble is, this installs the address of the cell instead
of the value in the cell. On worksheets this doesn't
matter, but in other macros its a big problem.
Please advise how to make the Name contain the value in
the cell instead of the address of the cell.
Sub SetConst()
Set rng = Workbooks("macros.xls").Names
("constants").RefersToRange
For Each cell In rng
Workbooks("macros.xls").Names.Add Name:=cell,
RefersTo:=cell.Offset(0, 1)
Next
End Sub
macro reads a set of configuring constants from a sheet
and installs them as names. The code that does that is
below.
Trouble is, this installs the address of the cell instead
of the value in the cell. On worksheets this doesn't
matter, but in other macros its a big problem.
Please advise how to make the Name contain the value in
the cell instead of the address of the cell.
Sub SetConst()
Set rng = Workbooks("macros.xls").Names
("constants").RefersToRange
For Each cell In rng
Workbooks("macros.xls").Names.Add Name:=cell,
RefersTo:=cell.Offset(0, 1)
Next
End Sub