Looping through the Cells in a Range in Excel VBA (Macro) - Code Included

Опубликовано: 01 Октябрь 2024
на канале: EverydayVBA
72,248
392

Grab the Free VBA Quick Reference Guide
https://chrisjterrell.com/p/getting-s...
In this video we use a for each loop to loop through all the cells in a range (we used selection because we can).

Code:
==================
Sub CellLoop()

Dim c As Range
Dim rng As Range

Set rng = Selection

cnt = 1

For Each c In rng
c = cnt
cnt = cnt + 1
Next



End Sub