VBA Excel dates

5 pts.
Tags:
Excel workbooks
VBA
Visual Basic
Visual Basic Error Messages
Why can I not make VBA Excel write me the date I put in the code, rather it shows always 00/01/1900 pls? See I wrote a short code that fills in the woorkbook (sheet), the date (any date) as a responce to a week number. The problem is that the code is only returning one single meaningless value of (00/01/1900), and that is after me formatting the cell to a date cell. before that it has asigned another funny date with (time) this time. 1 day ago - 3 days left to answer. Additional DetailsĀ  this is just a part of the procedure discribed in my original question. This is the part that's not working. pls try it to see if it gives you the same result described in my Q: above? Many many thanks to your reply. Sub proDate() Dim varDate As Date Dim varWkNr As Integer varWkNr = 1 If varWkNr = 1 Then varDate = 13 / 10 / 2010 Range("A1").Value = varDate End If End Sub

Software/Hardware used:
Excel

Answer Wiki

Thanks. We'll let you know when a new response is added.

Try assigning the date this way:

varDate = <b>”</b>13/10/2010<b>”</b>

———–

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following