Consulting

Results 1 to 2 of 2

Thread: Excel Date formatting issue

  1. #1
    VBAX Regular
    Joined
    Dec 2017
    Posts
    16
    Location

    Excel Date formatting issue

    Hi all,

    I am rather new to VBA. In my excel file, the date value is 1/5/2018 7:18:32 AM. However, as seen from the image, the AM/PM sign is missing. I need to copy the values over using VBA, but the result is the same, it still shows without AM/PM. I need it to be in this exact format. How can I achieve this?

    vbaDate.PNG

    Cheers,
    Jack

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,874
    something like:
    Selection.NumberFormat = "d/m/yyyy h:mm:ss AM/PM"
    or
    Selection.NumberFormat = "m/d/yyyy h:mm:ss AM/PM"
    (I can't tell from your example whether the format is day/month year of month/day/year).
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

Tags for this Thread

Posting Permissions

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