Reference Sequential cells

billandrew

Well-known Member
Joined
Mar 9, 2014
Messages
743
Evening All

Could someone provide a bit of explanation to the reference below.



Range(Cells(2, "D"), Cells(2, "F")).Cells(1) = "A"
Range(Cells(2, "D"), Cells(2, "F")).Cells(2) = "B"
Range(Cells(2, "D"), Cells(2, "F")).Cells(3) = "C"

Thnks
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
The lines refer to D2, E2 and F2, respectively. The "Cells(1)" on the end is saying to select the first cell from the the range object: "Range(Cells(2, "D"), Cells(2, "F"))", which refers to [D2:F2]. "Cells(2)" says to select the second cell, E2. Given that there are no variables involved, a more intuitive way to write it would be something like:
Code:
[D2:F2].value = Array("A","B","C")
 
Upvote 0
Range(Cells(2, "D"), Cells(2, "F")).Cells(1) is the first cell in range D2:F2, that is, cell D2.
 
Upvote 0
Cells(1) refers to [A1]
Cells(2) refers to [B1]
Cells(1,2) refers to [B1]
[B2] refers to [B2]
Range("B2") refers to [B2]
Range(Range("B2").Address) refers to [B2]
Columns(2).Cells(2) refers to [B2]
Cells(1).Offset(1,1) refers to [B2]
Cells(2,"B").Offset(1,1).Resize(2,3) refers to [C3:E4]
Union([B2],Cells(1),Range("A4")).Cells(2) refers to [B3]
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,200
Members
453,022
Latest member
RobertV1609

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