0

I'm trying to loop code from cell directly in a macro. But all the return values in the AD column are #NAME?. How can I fix this?

Note that my Column refer to K-Column which has Date value in a form like this: 24/6/2015 6:54:00 AM for example.

For PRow = lrow To 2 Step -1
    CurrentSheet.Cells(PRow, "AD").Value = "=CONCATENATE(YEAR(R[0]C[-19]), _ 
    ""/"",TEXT(MONTH(R[0]C[-19]),""00""))"
Next PRow

1 Answer 1

2

When using the R[]C[] Notation you need to add the value like this:

CurrentSheet.Cells(PRow, "AD").FormulaR1C1 = "=CONCATENATE(YEAR(R[0]C[-19]), ""/"",TEXT(MONTH(R[0]C[-19]),""MM""))"
Sign up to request clarification or add additional context in comments.

3 Comments

did you mean to write TEST(... or TEXT(...??
@IlhamideaZ Look at my edit, i tried an example and that seems to work. let me know if that is what you where looking for?!
OK, typo, my fault >< Thanks @marco-getrost ! :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.