Good evening all.
I was initially going to post a question about an issue with formatting dates in VBA, when adding 7 days onto the Date, but I've kind of solved the problem myself, which led to something else.
The above code would not work for me. No matter what I tried, afDate would always seem to return the date in the dd/mm/yyyy format, which is what my system is set to.
Whilst writing the post, though, I discovered that removing "DIM afDate As Date" rectified the problem.
My question now is why? Why will the code not word if I Dim afDate As Date? I would like to use Option Explicit, which means I need to declare afDate, though if I guess I'll have to leave it out if necessary.
Using Excel 2003 & Vista
Thank you for your time.
Sean
I was initially going to post a question about an issue with formatting dates in VBA, when adding 7 days onto the Date, but I've kind of solved the problem myself, which led to something else.
Code:
DIM afDate As Date
afDate = Format(Date + 7, "mm/dd/yyyy")
Whilst writing the post, though, I discovered that removing "DIM afDate As Date" rectified the problem.
My question now is why? Why will the code not word if I Dim afDate As Date? I would like to use Option Explicit, which means I need to declare afDate, though if I guess I'll have to leave it out if necessary.
Using Excel 2003 & Vista
Thank you for your time.
Sean
Last edited: