Reputation: 13
I would like to use the value of a cell as a name for this cell (in a range of cells). Basically, I try to do something like :
For Each Cell In MyIDRange
Cell.Name = Cell.Value2
Next Cell
The problem is "that name is not valid". I tried to use CStr(Cell.Value2), but I always get the error.
Upvotes: 0
Views: 153
Reputation: 8591
If you want to add names (as i mentioned in comment), please see this: https://msdn.microsoft.com/en-us/library/office/ff835300%28v=office.15%29.aspx
For Each c In MyIDRange
ActiveWorkbook.Names.Add _
Name := c.Value, _
RefersTo := c.Address
Next c
Do not use built-in object names as name of variable.
Upvotes: 1