Option Explicit Sub test() Dim lastrow As Long Dim i As Long Dim n As Long lastrow = Cells(Rows.Count, 2).End(xlUp).Row For i = 2 To lastrow Cells(i, "d").Value = n Mod 5 + 1 n = n + 1 Next End Sub
Option Explicit Sub test() Dim lastrow As Long Dim i As Long Dim n As Long lastrow = Cells(Rows.Count, 2).End(xlUp).Row For i = 2 To lastrow Cells(i, "d").Value = n Mod 5 + 1 n = n + 1 Next End Sub