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

just set it to a range, but i'm not sure what you mean by "save". save for how
long?
couple examples:

Sub test()
Dim ThatCell As Range
Set ThatCell = Worksheets("Sheet1").Range("A1")
ThatCell = 1
End Sub


Sub test2()
Dim i As Long
Dim ThatCell(5) As Range
For i = 1 To 5
Set ThatCell(i) = Worksheets("sheet1").Cells(i, 1)
ThatCell(i) = i + 1
Next
End Sub

--


Gary


"John" wrote in message
...
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