Reputation: 79
For some reason, I am receiving a
runtime error 1004 (Application-defined or object-defined error)
while I am trying to insert a formula. The file/ worksheet is active, the worksheet is not protected. The rowcount picks up the correct number of rows. So I am at a loss here.
'Adjust date format in temporary column
RowCount = Range("A2").CurrentRegion.Rows.Count
For i = 2 To RowCount
Worksheets("Data").Range("O" & i).Formula = "=TEXT(H" & i & "),""yyyy-mm-dd"")"
Next
Any ideas?
Upvotes: 0
Views: 84
Reputation: 79
The additional ") was the trick...
'Adjust date format in temporary column
RowCount = Range("A2").CurrentRegion.Rows.Count
For i = 2 To RowCount
Worksheets("Data").Range("O" & i).Formula = "=TEXT(H" & i & ",""yyyy-mm-dd"")"
Next
works just fine.
Upvotes: 1