When using the code below it works perfectly with the sheet Not protected but after protecting the sheet it gives (error 400) and opens the VB Editor after pressing the button but it still puts the correct values in the cells. The cells that are used are not locked but other adjacent cells are. I can't figure out why it is giving that error or how to correct it so that it does not give the error with the sheet protected.
-----------
Sub Dates()
Dim i As Integer
Range("A5").Select
For i = 1 To 7
ActiveCell.FormulaR1C1 = "=TODAY() - WEEKDAY(TODAY()*0.2)+" & i
ActiveCell.Offset(1, 0).Select
Next i
Range("A5:A11").NumberFormat = "DDDD ~ m/d/yy"
End Sub
Bookmarks