+ Reply to Thread
Results 1 to 4 of 4

VBA - excel import - changed date format

  1. #1
    Registered User
    Join Date
    03-08-2012
    Location
    Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    14

    VBA - excel import - changed date format

    Hi all,

    In my VBA, I import excel sheet (my raw data) from location x drive. This excel sheet consists of a couple of columns like:

    Name - BirthDate - MarriageDate
    Ivan 30/06/1984 - 01/07/2011

    However when it is gets imported, the dates change into the following format: 40954 (5 digit number)

    I can manually adjust it back to the desired format, but would liek to skip the manual work around? Any ideas what causes the below format change and how I may correct it?

    Thank you in advance.

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: VBA - excel import - changed date format

    Are you using text import to do this? If so you just need to specify that column as a date as part of the import process.

    It might help to see your code.

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Valued Forum Contributor
    Join Date
    08-29-2011
    Location
    Mississauga, CANADA
    MS-Off Ver
    Excel 2010
    Posts
    503

    Re: VBA - excel import - changed date format

    Use this for changing the format of the variable
    Please Login or Register  to view this content.
    or this to change the format of the cell
    Please Login or Register  to view this content.
    Regards,
    Khaled Elshaer
    www.BIMcentre.com

    Remember To Do the Following....
    1. Thank those who have helped you by clicking the Star below their post.
    2. Mark your post SOLVED if it has been answered satisfactorily:
    • Select Thread Tools (on top of your 1st post)
    • Select Mark this thread as Solved

  4. #4
    Registered User
    Join Date
    03-08-2012
    Location
    Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: VBA - excel import - changed date format

    Quote Originally Posted by Domski View Post
    Are you using text import to do this? If so you just need to specify that column as a date as part of the import process.

    It might help to see your code.

    Dom
    Hi there,

    No, I import in excel format, and in the original file the format of those columns is set up as a date, thus I do not see what is causing this format change. In my VBA, I just have import column B:C, thus I do not see how I may include the format in the VBA.

    Thx,

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1