Help understanding why range displays different results

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>
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
I do not know the specific answer to your question. But why not just use something like this:

Code:
Sub My_Data()
[A1] = "Me"
[A2] = "You"
[A3] = "Us"
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,102
Messages
6,128,851
Members
449,471
Latest member
lachbee

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top