+ Reply to Thread
Results 1 to 20 of 20

Vba losing date format

  1. #1
    Registered User
    Join Date
    08-06-2013
    Location
    Bradford
    MS-Off Ver
    Excel 2003
    Posts
    16

    Vba losing date format

    I created a chase list at work for shop floor but half way through the macro i find and replace . with / . When the macro comes to the end the date format is lost and has become general so the dates are not in order.

    Please can some one advise if they is anything i can do .

    Best regards
    Daniel

  2. #2
    Forum Contributor Jack7774's Avatar
    Join Date
    08-31-2012
    Location
    Georgia, US
    MS-Off Ver
    Excel 2010
    Posts
    576

    Re: Vba losing date format

    Are you asking to fix the macro or to recover the spreadsheet because you didn't have a backup?
    Thank those who have helped you by clicking the Star * below their name and please mark your post [SOLVED] if it has been answered satisfactorily.

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Vba losing date format

    Why are you doing the find/replace?
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    08-06-2013
    Location
    Bradford
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Vba losing date format

    I am asking for a fix for the macro. i am doing a find and replace because it comes out of SAP with dots.

  5. #5
    Forum Contributor Jack7774's Avatar
    Join Date
    08-31-2012
    Location
    Georgia, US
    MS-Off Ver
    Excel 2010
    Posts
    576

    Re: Vba losing date format

    Can you upload the spreadsheet with the macro please?

  6. #6
    Registered User
    Join Date
    08-06-2013
    Location
    Bradford
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Vba losing date format

    I can get the macro tomorrow as it is at work at the moment .

    Kind Regards

  7. #7
    Forum Contributor Jack7774's Avatar
    Join Date
    08-31-2012
    Location
    Georgia, US
    MS-Off Ver
    Excel 2010
    Posts
    576

    Re: Vba losing date format

    Ah okay. Until then. By chance are your numbers in german format from SAP?

  8. #8
    Registered User
    Join Date
    08-06-2013
    Location
    Bradford
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Vba losing date format

    No the Sap is in English but i have found on some find and replace it moves the column up a row and it changes some of the dates around i.e 02/05/2015 would turn out to be 05/02/2015.

  9. #9
    Forum Contributor Jack7774's Avatar
    Join Date
    08-31-2012
    Location
    Georgia, US
    MS-Off Ver
    Excel 2010
    Posts
    576

    Re: Vba losing date format

    It would be good to have a raw file from SAP so that I can choose how to open it and maybe there might be an easier fix for you.

  10. #10
    Registered User
    Join Date
    08-06-2013
    Location
    Bradford
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Vba losing date format

    currently excel attaches to sap and extracts the data in to a specific folder then opens it. and copys in to a file.

  11. #11
    Forum Contributor Jack7774's Avatar
    Join Date
    08-31-2012
    Location
    Georgia, US
    MS-Off Ver
    Excel 2010
    Posts
    576

    Re: Vba losing date format

    Something I found on SAP and Excel, not sure if this helps or not until you can get back to work and upload the file or spreadsheet though.

    http://scn.sap.com/docs/DOC-31015

  12. #12
    Registered User
    Join Date
    08-06-2013
    Location
    Bradford
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Vba losing date format

    I will get the excel macro file and upload tomorrow thanks Jack

  13. #13
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Vba losing date format

    Instead of using Find/Replace you could try using Data>Text to columns... on the columns that have dates.

  14. #14
    Registered User
    Join Date
    08-06-2013
    Location
    Bradford
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Vba losing date format

    When i use text to columns it moves the rows up one i don't understand why.

  15. #15
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Vba losing date format

    Have you checked the destination on 3rd step when using Data>Text to columns...?

  16. #16
    Registered User
    Join Date
    08-06-2013
    Location
    Bradford
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Vba losing date format

    Thanks i will test at work tomorrow but the field still losses the date format.

  17. #17
    Registered User
    Join Date
    08-06-2013
    Location
    Bradford
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Vba losing date format

    I will test again tomorrow but it still loses the date format.

  18. #18
    Registered User
    Join Date
    08-06-2013
    Location
    Bradford
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Vba losing date format

    Please see attachment below they are a few modules in the book.


    Kind Regards
    Attached Files Attached Files

  19. #19
    Forum Contributor Jack7774's Avatar
    Join Date
    08-31-2012
    Location
    Georgia, US
    MS-Off Ver
    Excel 2010
    Posts
    576

    Re: Vba losing date format

    No data there to convert though just macro. After thought though once you find and replace the . with / couldn't you setup the macro to multiply those dates by 1 and convert them from text to number because that is ultimately why excel doesn't recognize them as dates. For me at least without seeing the issue or creating it myself I can't help anymore to solve this problem. These other guys like norie will most likely be able to help though.

  20. #20
    Registered User
    Join Date
    08-06-2013
    Location
    Bradford
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Vba losing date format

    They wont be any data because it is directly taken from Sap.

    Kind regards

+ 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. Converting from the 1904 date format to the 1900 date format without losing data
    By Patty McJorst in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-01-2020, 12:53 PM
  2. Losing Data Format when merging into Word
    By Kdhowery in forum Excel General
    Replies: 0
    Last Post: 03-31-2014, 01:15 PM
  3. Copy custom format without losing leading zeros
    By ucyzgba in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-14-2013, 09:47 AM
  4. [SOLVED] Losing format information in For Loop iterations
    By GFIJames in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-24-2012, 11:17 AM
  5. Losing format because of multiple IF statements
    By TJC123 in forum Excel General
    Replies: 4
    Last Post: 11-01-2008, 10:43 AM
  6. Changing time format without losing data
    By lajones3 in forum Excel General
    Replies: 19
    Last Post: 11-21-2006, 05:43 PM
  7. [SOLVED] How do I change date format without losing data?
    By ScottNovo in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 04-15-2005, 06:06 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