View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Rowan[_4_] Rowan[_4_] is offline
external usenet poster
 
Posts: 38
Default unique id for excel cell/range objects

Patrick was refering to Named Ranges not the cell.name property.

To add a name select the cell (or range) and then from the menus
InsertNameDefine. Enter a name that makes sense (eg MyRange) and click OK.

You can then refer to this eg:

Range("MyRange").value = 5

MyRange will then always refer to this cell even if it's address is moved by
adding columns etc.

If you want to set the name via VBA use the macro recorder to get the
relevant code.

Hope this helps.
Rowan

" wrote:

thanks again for the reply.

The problem as I already told is that the name of the cell itself
changes once you move the cell to the next column

eg., if the cell is in first row and first column, the call cell.Name
returns "$A$1"
but as soon I insert a column in the beginning the cell.Name returns
"$B$1"

Its not allowing me to change the name either.

I am not an experienced Excel user so, if you feel I am pestering with
a pretty basic question, please bear with me.

Can you give me an example of how to set the name for a cell and row so
that I can use it as a unique id.

thanks again