+ Reply to Thread
Results 1 to 6 of 6

Macro filling UK Date that is a value as a US date in column with same format as source

  1. #1
    Registered User
    Join Date
    08-06-2012
    Location
    Hereford
    MS-Off Ver
    Excel 2010
    Posts
    11

    Macro filling UK Date that is a value as a US date in column with same format as source

    I have a file in named range 'caldata3' with a date saved as a value with the format
    Date
    14/03/2012
    English (United Kingdom)
    If the date in question is 07/01/2021 my macro fills this data to another file but it appears as a US date of 01/07/2021. The target column has the same format as above.
    Here is my code.

    Please Login or Register  to view this content.
    I posted this query in the Microsoft forum but the only suggestion was;
    Please Login or Register  to view this content.
    This is no good as it changes the date to the current one and I need to keep the original date.

    I am stumped and would be most grateful for some help with this, thanks.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Macro filling UK Date that is a value as a US date in column with same format as sourc

    This is a guess, but give it a shot...

    Please Login or Register  to view this content.
    The DateValue function converts a Text-Date into a Serial-Date using your computer's system date setting e.g. English (United Kingdom) d/m/yyyy
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    08-06-2012
    Location
    Hereford
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Macro filling UK Date that is a value as a US date in column with same format as sourc

    Quote Originally Posted by AlphaFrog View Post
    This is a guess, but give it a shot...

    Please Login or Register  to view this content.
    The DateValue function converts a Text-Date into a Serial-Date using your computer's system date setting e.g. English (United Kingdom) d/m/yyyy
    Thanks for trying AlphaFrog.
    Unfortunately source date of 07/01/21 saved to the ledger as 01/07/21.

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Macro filling UK Date that is a value as a US date in column with same format as sourc

    Don't define MyRanges as a String. Define it as Variant so you can put an actual date value in there.
    Rory

  5. #5
    Registered User
    Join Date
    08-06-2012
    Location
    Hereford
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Macro filling UK Date that is a value as a US date in column with same format as sourc

    Quote Originally Posted by rorya View Post
    Don't define MyRanges as a String. Define it as Variant so you can put an actual date value in there.
    Thank you rorya. You have saved me losing sleep over the weekend.
    I like your dog too.
    Many many thanks

  6. #6
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Macro filling UK Date that is a value as a US date in column with same format as sourc

    Glad we could help.

+ 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. Update given date column in general format to date format in VBA
    By l3sushi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-02-2016, 02:32 PM
  2. [SOLVED] I need help on Auto Filling the date across 31 worksheets in my format
    By PeterSCTS in forum Excel General
    Replies: 6
    Last Post: 05-07-2014, 06:27 PM
  3. [SOLVED] I need help in auto filling the date across 31 worksheets using my format
    By PeterSCTS in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-07-2014, 01:28 AM
  4. Macro to change date value from one date format to another date format
    By RG12 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-23-2013, 04:51 AM
  5. [SOLVED] Macro to update pivot item (date format) in pivot table to latest date from data source.
    By rocksan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-10-2012, 03:18 AM
  6. Column Range with date Format MM/DD/YYYY independate of sys date Format
    By gaursh in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-18-2011, 03:31 AM
  7. Filling Column with date
    By Bill in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-21-2005, 02:05 AM

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