Grab the Free VBA Quick Reference Guide
[ Ссылка ]
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
Ещё видео!