+ Reply to Thread
Results 1 to 4 of 4

VBA Change Date from European

Hybrid View

  1. #1
    Registered User
    Join Date
    05-13-2010
    Location
    Bellingham, Washington
    MS-Off Ver
    Excel 2007
    Posts
    12

    VBA Change Date from European

    Hello,

    I am writing a macro in which I need to change two columns of dates from european format to standard and change the periods to dashes. The dates currently look like 30.06.2012 and I need them to appear as 06/31/2012. In recording this change I see that I can use:

    Columns("B:B").Select
        Selection.TextToColumns Destination:=Range("B1"), DataType:=xlDelimited, _
            TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
            Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
            :=Array(1, 4), TrailingMinusNumbers:=True
    but the goal is to have an extremely clean, short macro that other users can easily troubleshoot. I've been able to simplify most other functions down to one line of code. Is there a simpler way to do this?

    Thank you!
    Last edited by Cutter; 07-31-2012 at 09:36 AM. Reason: Added code tags

  2. #2
    Valued Forum Contributor
    Join Date
    06-17-2009
    Location
    Chennai,India
    MS-Off Ver
    Excel 2003,excel 2007
    Posts
    678

    Re: VBA Change Date from European

    why do you need a macro for thsis

    suppose A1 has entry 30.06.12
    in B1 type this formula
    =(MID(A1,4,2)&"/"&LEFT(A1,2)&"/"&RIGHT(A1,2))*1
    copy B1 down.
    if you do not ant col. A delete that colum
    Last edited by venkat1926; 07-31-2012 at 01:42 AM.
    I am not an expert. better solutions may be available
    $$$$venkat1926$$$$@gmail.com

  3. #3
    Registered User
    Join Date
    05-13-2010
    Location
    Bellingham, Washington
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: VBA Change Date from European

    It is part of a larger macro that is designed to enable users to paste the raw data in and have the completed report come out with the push of a button.

  4. #4
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: VBA Change Date from European

    @ Jmarsh4

    Please notice that code tags have been added to your post. You've been a member long enough to know that the forum rules require them so please remember to add them whenever showing code in any of your future posts. To see instructions for applying them, click on the Forum Rules button at top of the page and read Rule #3.
    Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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