DoLoop
05-22-2008, 01:30 AM
Hi,
I've just discovered that assigning values from cells or a range of cells to single variables or arrays can be simply done by following code:
Sub AssigningValues ()
Dim a, b, c, d
a = [A1] 'single value referring to cell A1
b = [A1:A10] '2D array
c = [transpose(A1:A10)] '1D array
d = [test] 'in case cell A1 has name "test"
End sub
Now, this looks a better method to me, than using
.Cells(1,1)
or
.Range("A1").Value
Can anyone tell me if this method is faultless? Or do I have to take into account some surprises?
Thx.
I've just discovered that assigning values from cells or a range of cells to single variables or arrays can be simply done by following code:
Sub AssigningValues ()
Dim a, b, c, d
a = [A1] 'single value referring to cell A1
b = [A1:A10] '2D array
c = [transpose(A1:A10)] '1D array
d = [test] 'in case cell A1 has name "test"
End sub
Now, this looks a better method to me, than using
.Cells(1,1)
or
.Range("A1").Value
Can anyone tell me if this method is faultless? Or do I have to take into account some surprises?
Thx.