+ Reply to Thread
Results 1 to 5 of 5

Custom format date and time on import

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    10-02-2013
    Location
    Houston, TX
    MS-Off Ver
    office 365
    Posts
    638

    Custom format date and time on import

    I have a import macro that imports a lot of data and I import a date and time from one excel sheet that has a wrong format.

    format it starts as
    2022:02:01:01:51:53

    what I use to import
    Surveys.Range("A17:A" & maxRow + 14) = wBookSvy.Range("A3:A" & maxRow).Value
    format I want it in after import
    2/1/2022 1:51:53 AM


    is this possible.

    IK tried changing the cell format but could get it correct

  2. #2
    Forum Expert
    Join Date
    10-11-2021
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    1,404

    Re: Custom format date and time on import

    For example, put the wrong input in A1 and run this macro to see the result in B1

    Sub jec()
    Dim a
    a = Split([A1], ":", 4)
    [B1] = Format(CDate(Join(Array(a(1), a(2), a(0)), "-")) + TimeValue(a(3)), "mm/dd/yyyy hh:mm:ss AM/PM")
    End Sub

  3. #3
    Forum Contributor
    Join Date
    10-02-2013
    Location
    Houston, TX
    MS-Off Ver
    office 365
    Posts
    638

    Re: Custom format date and time on import

    that can work but I cant add any more columns to the sheet.

    Format the entire range (A17:A367) at once

  4. #4
    Forum Expert
    Join Date
    10-11-2021
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    1,404

    Re: Custom format date and time on import

    You need to fill an array with the right format, then paste the complete array in your destination sheet

  5. #5
    Forum Contributor
    Join Date
    10-02-2013
    Location
    Houston, TX
    MS-Off Ver
    office 365
    Posts
    638

    Re: Custom format date and time on import

    And How do I do that

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Increase Time by 1 minute in custom Date/Time Format
    By godawgs in forum Excel General
    Replies: 1
    Last Post: 09-07-2018, 09:32 AM
  2. Coding Date/Time Custom Format
    By swalsh^s96 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-05-2015, 01:54 PM
  3. [SOLVED] How to create a Custom Date Time Format
    By dominicm in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-10-2015, 01:05 AM
  4. Date Time Picker custom format property ?
    By Walt in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-24-2014, 01:00 PM
  5. [SOLVED] Drag and fill with a custom date/time format
    By Mr.Chip in forum Excel General
    Replies: 2
    Last Post: 07-17-2013, 12:36 PM
  6. Custom format, combined date, time and letter
    By bugmenot in forum Excel General
    Replies: 3
    Last Post: 12-15-2008, 05:09 AM
  7. Custom Date & Time format
    By MSwan1 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-18-2005, 04:05 PM

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