Thread: named cells
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default named cells

Dim ThatCell As Range
Set ThatCell = Cells(1, 2)

Of course, ThatCell does not have to refer to only one cell (it can be
multiple areas/cells - it just cannot span different worksheets). You can
add cells to it by

Set ThatCell = Union(ThatCell, Cells(1, 3))

and check if a cell is a part of ThatCell range by

If Intersect(ThatCell, Cells(1, 4)) Is Nothing Then
'Not part of the range
Else
'Included in ThatCell range
End If



"John" wrote:

Is there a way to save and refer to a cell with a one name variable?
Instead of range something or cells(1,2) or "A1" can you just call it,
like, "ThatCell". Like... ThatCell = Cells(1,2) and then ThatCell means
Cell(1,2) not the value that is in cell(1,2).


I am doing a trial and error solution and have to save the cells I've
tried... not their value. I am hoping to save them in an array. I know I
can save them in an array Saved(x,y) with the colum,row coordinates...
it's just kind of a pain.

I'd like to end up with trial(1) trial(2) etc .

thanks

John