+ Reply to Thread
Results 1 to 8 of 8

VBA Macro to capture DATA in dd/mm/yyyy even though system date format is mm/dd/yyyy

  1. #1
    Registered User
    Join Date
    09-07-2012
    Location
    Dubai
    MS-Off Ver
    Excel 2007
    Posts
    14

    VBA Macro to capture DATA in dd/mm/yyyy even though system date format is mm/dd/yyyy

    Hi experts,

    Could you pls help to write a excel vba macro to capture Data of Current Date in dd/mm/yyyy, even though my system date format is in different one. I am using excel/office 2007.

    Thanks in advance,

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,136

    Re: VBA Macro to capture DATA in dd/mm/yyyy even though system date format is mm/dd/yyyy

    hi vijay21, you can record the following actions. assuming your dates are in column A, select the whole column
    go to Data -> Text to Columns -> Next -> Next -> Date: MDY - > Finish

    it will look something like this:
    Please Login or Register  to view this content.

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Registered User
    Join Date
    09-07-2012
    Location
    Dubai
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: VBA Macro to capture DATA in dd/mm/yyyy even though system date format is mm/dd/yyyy

    I think I did not explain fully on my req. I am trying to capture the Entry Date in a excel cell thru an userform. I have done coding to get the current date in a variable. It works fine when the date is in brit format (dd/mm/yyyy). I wish to keep the same format of date even though my system format is changed to usa format (mm/dd/yyyy).

    Thanks,

  4. #4
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    13,764

    Re: VBA Macro to capture DATA in dd/mm/yyyy even though system date format is mm/dd/yyyy

    I think VBA does that for you (but i'm no VBA expert).

    Otherwise post an excel file,without confidentional information.

    Please also add the desired result.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  5. #5
    Registered User
    Join Date
    09-07-2012
    Location
    Dubai
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: VBA Macro to capture DATA in dd/mm/yyyy even though system date format is mm/dd/yyyy

    Thanks for your reply.

    I am looking to write a VBA code inside the macro. Could any one help me.

  6. #6
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    13,764

    Re: VBA Macro to capture DATA in dd/mm/yyyy even though system date format is mm/dd/yyyy

    In that case, you don't read my suggest in #2 well enough.

  7. #7
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    2013 on Win10 (desktop), 2007 on Win10 (notebook)
    Posts
    8,097

    Re: VBA Macro to capture DATA in dd/mm/yyyy even though system date format is mm/dd/yyyy

    Hi, vijay21,

    the long for a date in Format dd/mm/yyyy should be equal to that of mm/dd/yyyy as long as Excel recognises the input as a Date. So maybe use the CLng-conversion for your search or apply the Autofilter (which in VBA would need a long value for putting up any result).

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  8. #8
    Registered User
    Join Date
    09-07-2012
    Location
    Dubai
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: VBA Macro to capture DATA in dd/mm/yyyy even though system date format is mm/dd/yyyy

    hi,

    I got an idea to store the date using NumberFormat in VBA macro.

    Please Login or Register  to view this content.
    I will try it to check ! Hope this works..... thanks for your guidence Holger.

+ 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