Results 1 to 7 of 7

Importing Multiple Files to Single Workbook date issue

Threaded View

  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.

    _________________________________


    Sub ImportAllFiles()
          
        Dim Path            As String
        Dim Filename        As String
        Dim WkB             As Workbook
        Dim Ws              As Worksheet
          
        Application.EnableEvents = False
        Application.ScreenUpdating = False
        Path = ActiveWorkbook.Path
        Filename = Dir(Path & "\*.", vbNormal)
        Do Until Filename = ""
            If Filename <> ThisWorkbook.Name Then
            Set WkB = Workbooks.Open(Filename:=Path & "\" & Filename, Format:=1)
            For Each Ws In WkB.Worksheets
                Ws.Copy After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)
            Next Ws
            WkB.Close False
            Filename = Dir()
            Else: Filename = ""
            End If
        Loop
    
        Application.EnableEvents = True
        Application.ScreenUpdating = True
    
    End Sub
    Attached Files Attached Files
    Last edited by arlu1201; 10-25-2012 at 06:24 AM. Reason: Use code tags in future.

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