+ Reply to Thread
Results 1 to 7 of 7

How to copy and paste date but maintaining the date format using macros

  1. #1
    Registered User
    Join Date
    01-16-2014
    Location
    Nairobi , Kenya
    MS-Off Ver
    Excel 2007
    Posts
    4

    How to copy and paste date but maintaining the date format using macros

    Hi all,
    I have an issue with macros when copying and pasting date, the macro is inter-changing day and month. Original date is DDMMYYYY, but on applying the macro the date ends up as MMDDYYYY. Strange enough is dates above 12 run well except for the onces from 1 to 12.
    Below is the macro, will appreciate any assistance on this

    wb.Sheets(1).UsedRange.Columns("M").Copy
    ThisWorkbook.Sheets(TradeDataSheet).Range("B5").PasteSpecial XlPasteType.xlPasteValuesAndNumberFormats

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: How to copy and paste date but maintaining the date format using macros

    Try,

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    01-16-2014
    Location
    Nairobi , Kenya
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: How to copy and paste date but maintaining the date format using macros

    Thanks but not solving the issue. In the source sheet the date is 10/01/2014 (DDmmYY) but upon running the micros it ends up as 01/10/2014.

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: How to copy and paste date but maintaining the date format using macros

    It might be a formatting issue. You either format it manually, or

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-16-2014
    Location
    Nairobi , Kenya
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: How to copy and paste date but maintaining the date format using macros

    Correct looks date format has an issue been able to do it manually.
    However my macros how do i plug it in so as to avoid manual intervention.
    Thanks.

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: How to copy and paste date but maintaining the date format using macros

    If the data to format are in column B, add the above code (Post #4) to your existing code.

  7. #7
    Registered User
    Join Date
    01-16-2014
    Location
    Nairobi , Kenya
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: How to copy and paste date but maintaining the date format using macros

    Thanks it woked much appreciated AB33.

+ 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. reference column date (yesterday) to get Month(Date) for copy paste
    By jukabub in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-09-2013, 03:52 AM
  2. Reference a date, then copy and transpose paste into a date specific location
    By nelmsd in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 02-26-2013, 03:30 PM
  3. Date format macro and copy paste
    By Libster78 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-07-2010, 11:08 AM
  4. Copy n Paste time date/time format
    By jazbath in forum Excel General
    Replies: 5
    Last Post: 10-12-2009, 07:01 PM
  5. Copy-paste from csv to xls macro > wrong date format
    By Gero in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-30-2009, 06:12 AM

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