VBA Excel – Looping Through a Range of Cells

Refer­ring Excel cells using For…Next –Loop

For i = 1 to 10

Range(“A” & i).Value = 1

Next

Enter ‘1’ in Cells from A1 to A10.

Refer­ring Columns of excels using For-Loop

For i = 1 To 26

Range(Chr(65 + i) & "1").Value = 2

Next

Enter ‘2’ in cells from A1 to Z1

Refer­ring Excel cells using For…Each…Next –Loop

For Each i In Sheet1.Range("H1:H5")

i.Value = 10

Next

Enter ‘10’ in Cells from H1 to H5.

 

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.

Cre­ate Dynamic or Run-time Work­Sheets using Macro

3D-Ranges – Fil­lAcrossSheets Method

Cells Ranges Off­set — Active Cell

Cur­ren­tRe­gion

Happy Macro­ing :)

Sumit Jain

 

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>