# Thread: Date loop Thanks:  1 Post #5344633 (1) Likes: 0

1. ## Date loop

Hello: I need a sub to input last month's date into a column of data and then hard code the date. The only solution I came up with is below, but I'm wondering why it's not creating a circular reference. Thank you! I'm sure it has something to do with equivalency, but I'm still new!

Code:
```Sub temp()
Dim i As Long
For i = 2 To 4
Cells(i, 2).Formula = "=EOMONTH(TODAY(),-1)"
Cells(i, 2).Value = Cells(i, 2).Value
Next i

End Sub```

2. ## Re: Date loop

There is no circular reference because the formula does not use the same cell in the calculation.

It can also be like this:

Code:
```Sub temp2()
With Range("B2:B4")
.Formula = "=EOMONTH(TODAY(),-1)"
.Value = .Value
End With
End Sub```

3. ## Re: Date loop

Thank you Dante!

5. ## Re: Date loop

It can be done even more directly
Code:
```Sub temp3()
Range("B2:B4").Value = Date - Day(Date)
End Sub```

6. ## Re: Date loop

Originally Posted by Peter_SSs
It can be done even more directly
Code:
```Sub temp3()
Range("B2:B4").Value = Date - Day(Date)
End Sub```
If the range is really fixed and non-changing, this can be shortened to this...
Code:
```Sub temp3()
[B2:B4] = Date - Day(Date)
End Sub```