Date format switch

RonEmm

Board Regular
Joined
Aug 18, 2009
Messages
108
From an import file I retrieve o.a. cells that contain a date. The date is in the format dd-mm-yy. At the end of the data, for some reason a blank is added so the complete contents looks like e.g.: "01-06-10 "

After copying that cell into a new worksheet manually and pressing F2 the blank is gone and the date looks like "01 jun 2010", which is correct. I tried doing the same using VBA but then the day and month are switched so instead of June 1, I get January 6 using the same format "dd mmm yyyy". Local settings already are set to Dutch.

Does anyone know a solution so I can keep using VBA?

I use Office 2007 - Dutch.

Thanks!
 

Some videos you may like

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

schielrn

Well-known Member
Joined
Apr 4, 2007
Messages
6,934
Maybe try using text to columns in vba. You can record a macro and in the 3rd step there is a date radio button and you can choose your format such as MDY or DMY or so forth.

Maybe that will help?
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,573
Messages
5,512,130
Members
408,881
Latest member
Pooxie

This Week's Hot Topics

  • Sort code advice please
    Hi, I have the code below which im trying to edit but getting a little stuck. This was the original code which worked fine,columns A-F would sort...
  • SUMPRODUCT with nested If statement
    Hi everyone, Hope you're all well. I'm hoping someone will be able to point me in the right direction with a problem I'm having with a SUMPRODUCT...
  • VBA - simple sort is killing me!
    Hello all! This should be so easy, but not for me, apparently! I have a table of data that can be of varying lengths and widths. My current macro...
  • Compare Two Lists
    I have two Lists and I need to be able to Identify differences between them. List 100 comes from a workbook - the other is downloaded form the...
  • Formula that deducts points for each code I input.
    I am trying to create a formula that will have each student in my class start at 100 points and then for each code that I enter (PP for Poor...
  • Conditional formatting formula required for day of week and a value
    Hi, I have a really simple spreadsheet where column A is the date, column B is the activity total shown as a number and column C states the day of...
Top