+ Reply to Thread
Results 1 to 7 of 7

Importing Multiple Files to Single Workbook date issue

  1. #1
    Registered User
    Join Date
    04-10-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    4

    Importing Multiple Files to Single Workbook date issue

    Hi all,

    I am having an issue with a macro I am writing and can't get to the bottom of it.

    The aim is to import multiple files in a folder into a single workbook. These files are tab delimited files.

    The issue is, that the first column of all files is a date and time.
    When I import and data using the below macro, the date and time gets all messed up.
    The raw date and time is in UK format but when I import all the files to the single workbook, some of the dates get changed to US format and some don't.
    I want all the dates to be in UK format as that of the raw data.

    Any ideas what the issue might be?

    Any help would be most appreciated.

    Thanks in advance.

    _________________________________


    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by arlu1201; 10-25-2012 at 06:24 AM. Reason: Use code tags in future.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Importing Multiple Files to Single Workbook date issue

    Did you try pastespecial (xlpastevaluesandnumberformats) ?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    04-10-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Importing Multiple Files to Single Workbook date issue

    To be honest, I am very new to VBA.
    Not sure where I would put that in.
    I am not pasting anything.
    Just using the worksheet copy function to bring one worksheet to the other workbook
    Is it possible to do a worksheet copy with a pastespecial?

  4. #4
    Registered User
    Join Date
    04-10-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Importing Multiple Files to Single Workbook date issue

    I have also tried to use Workbooks.OpenText instead of Workbooks.Open, which I thought would keep all cells as text strings, but keep getting a
    Compile error:
    Expected Function or variable

  5. #5
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Importing Multiple Files to Single Workbook date issue

    Instead of doing a worksheet.copy, you can try copying the contents of the worksheet. That way, you can use a pastespecial command.

  6. #6
    Registered User
    Join Date
    04-10-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Importing Multiple Files to Single Workbook date issue

    Got to the bottom of it.
    Just had to put in Local:=True in the .open syntax.

    Thanks for the help. Most appreciated.

  7. #7
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Importing Multiple Files to Single Workbook date issue

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    I will do it for you this time.
    Last edited by arlu1201; 10-25-2012 at 07:45 AM.

+ 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