Repeat same value on next 15 rows multiple times each time a condition is satisfied

Viewed 86

I'm new to VBA but I absolutely need it for my work.

I have a file with multiple columns. I have one column, 4th one, that marks when I'm going from one group to another. It has the number 1 written once at the begining of each group. For my 1st column, I would like to write the letter "P" for 15 consecutive rows each time I encounter the number 1 on the 4th column. I wrote a piece of code but I don't know how to make it do it for 15 rows each time.

Thank you for your help.

Sub InsertP()

Dim i As Double

For i = 1 To 400000

If Cells(i, 4) = 1 Then

Cells(i, 1) = "P"


End Sub
0 Answers
Related