D
D
DPS_ninja2019-01-31 15:51:43
excel
DPS_ninja, 2019-01-31 15:51:43

How to loop an Excel macro?

Tell me please. How to loop an Excel macro? so you need to go up to 3000 lines. Thanks


Sub Macro3()
'
' Macro3 Macro
'
'
ActiveCell.FormulaR1C1 = "0"
Range("A14").Select
ActiveCell.FormulaR1C1 = "0"
Range("A15").Select
ActiveCell.FormulaR1C1 = "0"
Range(" A16").Select
ActiveCell.FormulaR1C1 = "0"
Range("A17").Select
ActiveCell.FormulaR1C1 = "0"
Range("A18").Select
ActiveCell.FormulaR1C1 = "0"
Range("A19").Select
ActiveCell.FormulaR1C1 = "0"
Range("A20").Select
ActiveCell.FormulaR1C1 = "0"
Range("A21").Select
ActiveCell.FormulaR1C1 = "0"
Range("A22").Select
ActiveCell.FormulaR1C1 = "0"
Range("A23").Select
ActiveCell.FormulaR1C1 = "0"
Range("A24").Select
End Sub

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
Creont, 2019-01-31
@DPS_ninja

Use cycles.

Dim i As Integer
For i = 1 To 6
    Cells(i, 1).Value = 100
Next i

https://www.excel-easy.com/vba/loop.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question