For­mat : Cells(Row,Column)

Excel is rep­re­sented in a grid for­mat, tab­u­lar form in rows and columns, so to reach to par­tic­u­lar cell you need tell to com­piler the cell is located in which row and which col­umn in that par­tic­u­lar row.

Ex: in VBA Excel when you say Cells(2,3) which means, in 2nd row and in 3rd col­umn means “C2

Some of the very effec­tive func­tions of Cells are

  • Cells.Select
  • Cells.ClearContents
  • Cells.SpecialCells(xlCellTypeLastCell) (Ex: Delete Blank rows)


These func­tions are pretty much sim­i­lar to other VBA Excel func­tions like UserRange.Clearcontents or UserRange.Select or UsedRange.Copy

To know more about User­Range Click here (VBA Excel-Range)

But while using Cells, some­times it’s a tedious task to find out which cell you are talk­ing about when you say suppose

Cells(18,31) which means 18th rows and 31st col­umn (“AE”), rather we pre­fer say­ing it as “AE18” instead 18,31

So that’s why we have Range and it’s rec­om­mended to use Range over Cells at most of the places

Also Read about

Cells

Off­set

Range

Range By using A1 Notations

Refer to Cells by Using Short­cut Notation

Refer to Mul­ti­ple Ranges : Union Method

Loop­ing Through a Range of Cells

Select and Acti­vate Cells — Select

Select and Acti­vate Cells — Activate

3D-Ranges — Work­ing with Mul­ti­ple Work­Sheets At The Simultaneously.

3D-Ranges – Fil­lAcrossSheets Method

Cells Ranges Off­set — Active Cell

Cur­ren­tRe­gion

 

Happy Macro­ing :)

Sumit Jain

 

One Thought on “VBA Excel — Cells, Ranges and Offset : Cells

  1. Pingback: vba - sum variable range of rows to the left - Page 2

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Post Navigation