godparticle
New Member
- Joined
- Feb 2, 2018
- Messages
- 5
I asked this on another forum but the answer was confusing and they seem to frown on explaining why
Supposing I want to simply write the first 3 cells of the first row, I might do this:
<code><code>'writes to first row
Set Rng = Range("A1:C1")
Rng(1) = "blah"
Rng(2) = "blah2"
Rng(3) = "blah3"
</code>
However, if I do it this way, it writes to the first column instead
'writes to first column(expected to write to first row)
Set Rng = Range("A1, B1, C1")
Rng(1) = "blah"
Rng(2) = "blah2"
Rng(3) = "blah3"
The explanation I received said that excel interprets Range("A1,B1,C1") as only "A1". I'm not sure why that is.
Also, it was explained that Rng(1) is only supplying the row index, so why does Rng(x) in the first example write
to the first row only when it should theoretically be writing to the the first column(eg, Rng(2) would be row 2 but it writes to row 1, second cell)
Any help would be appreciated.
</code>
Supposing I want to simply write the first 3 cells of the first row, I might do this:
<code><code>'writes to first row
Set Rng = Range("A1:C1")
Rng(1) = "blah"
Rng(2) = "blah2"
Rng(3) = "blah3"
</code>
However, if I do it this way, it writes to the first column instead
'writes to first column(expected to write to first row)
Set Rng = Range("A1, B1, C1")
Rng(1) = "blah"
Rng(2) = "blah2"
Rng(3) = "blah3"
The explanation I received said that excel interprets Range("A1,B1,C1") as only "A1". I'm not sure why that is.
Also, it was explained that Rng(1) is only supplying the row index, so why does Rng(x) in the first example write
to the first row only when it should theoretically be writing to the the first column(eg, Rng(2) would be row 2 but it writes to row 1, second cell)
Any help would be appreciated.
</code>