Why Cells takes Row,Col as arguments

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,805
Office Version
  1. 2016
Platform
  1. Windows
Hi
From Object Oriented point of view, I understand Cells is a property of Range Class and its type is Range. So I understand this code
Code:
   cells.clear

but what I do not understand this
Code:
    cells(1,1).value ="hello"

Where it says Cells takes Row, and Column as arguments? If you check Range class, you would see Cells defined as

Property Cells As Range

Nothing mentioned about Row and Column?

https://docs.microsoft.com/en-us/office/vba/api/excel.range.cells

Any help would be very much appreciated. Thank you
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Cells(row, col) is actually short for Cells.Item(row, col).
 
Upvote 0
Thank you very much. It does make sense now, but I have another question now! Qhy excel is allowing us to do Cells(1,1), is it to make it easier for users. I mean is that an exception or there are other examples or rules that we can eliminate the second object to make it easier for users?

Thank you once again.
 
Upvote 0
Item is the default property so you can generally leave it out.
 
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

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