+ Reply to Thread
Results 1 to 3 of 3

VBA to change date format.

  1. #1
    Registered User
    Join Date
    05-08-2018
    Location
    Portugal
    MS-Off Ver
    2013
    Posts
    6

    VBA to change date format.

    Hi guys!

    I've an assignment to change the date format from YY-MM-DD to DD-MM-YYYY.
    The function must only work in a specific column. And the function has to be used multiple times, so the function have to check that the selected cell are the YY-MM-DD format and then change them to the DD-MM-YYYY format.

  2. #2
    Forum Guru mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,205

    Re: VBA to change date format.

    You will need to be looking at and manipulating the .NumberFormat property of the cells in question.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  3. #3
    Registered User
    Join Date
    05-08-2018
    Location
    Portugal
    MS-Off Ver
    2013
    Posts
    6

    Re: VBA to change date format.

    Quote Originally Posted by mikerickson View Post
    You will need to be looking at and manipulating the .NumberFormat property of the cells in question.

    Can you explain a little further?
    I'm very new to VBA

    I was thinking if it was possible to use LEFT, MID, RIGHT functions, and maybe an IF function to make sure that the selection is already the "wrong" one?
    Last edited by HowTo; 05-08-2018 at 04:45 PM.

+ 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. Show Error when a cell with number format change to date format
    By delroba in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-08-2015, 02:57 AM
  2. [SOLVED] Date formula - Change Format to YYYYMMDD from Exported Format
    By haleakala17 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-21-2014, 03:22 PM
  3. [SOLVED] help on vba code to change the error date format as standard format mm/dd/yyyy
    By johnodys in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-13-2013, 01:10 AM
  4. Excel:How change the textbox format from text to date format?
    By inpetto in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-10-2013, 08:23 AM
  5. Change backwards number format to date format
    By vickie10200 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-10-2013, 01:32 PM
  6. Not able to change date format into proper excel date format
    By excel5111987 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-18-2011, 08:19 AM
  7. Userform date format reverting back to us format on change event
    By jpruffle in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-10-2009, 12:34 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