• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Hi I want to impose a date with an European date format (DD/MM/Aaaa)

van gysel

New Member
In the spreadsheet I convert the date in text but whe I make a macro that copy that data to another sheet past value and past formats , sometimes it converts it into US format
I dont understand why and it is annlying because that data must be experoted to another system
I'd like to impose the date format in VBA to make sure but I don't find the whright command
 
Hi ,

Can you specify the format of the text string which you are using in your code as input and output ?

The correct way to format the date output from your VBA code would be to use the in-built date format constants xlshortdate or xllongdate , since then this would adjust itself to whichever system you run the code on.

Thus a statement such as :

Format(date_variable , xlshortdate )

will output the contents of date_variable in the appropriate format.

Narayan
 
THanks I will try this
What I don't understand is the it works 99% of the time and sometimes not
since it is a lab sample it is very important
 
Hi ,

If you can post those samples of input dates where you are finding the output is not properly formatted , we can see what the problem is.

Narayan
 
Back
Top