+ Reply to Thread
Results 1 to 23 of 23

Macro to format date correctly

  1. #1
    Registered User
    Join Date
    07-20-2015
    Location
    NYC
    MS-Off Ver
    2010
    Posts
    70

    Exclamation Macro to format date correctly

    Hi,
    Can someone please help me fix the macro for the "Maroon" tab. So it formats the date correctly MM-DD-YY, when it copies from yellow to maroon tab?
    I believe the problem lies here

    Please Login or Register  to view this content.
    See attached doc

    Once you click on "Copy Cancelled" button on the Cancellations Report (maroon tab), it does everything perfectly. Except its not formatting the date on column I correctly. Can you help? Thanks in advance.

    Cele
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by alansidman; 01-25-2016 at 10:55 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    12-22-2015
    Location
    HK
    MS-Off Ver
    2010
    Posts
    532

    Re: Macro to format date correctly

    Try this:

    Please Login or Register  to view this content.
    Last edited by alansidman; 01-25-2016 at 10:55 PM.

  3. #3
    Registered User
    Join Date
    07-20-2015
    Location
    NYC
    MS-Off Ver
    2010
    Posts
    70

    Re: Macro to format date correctly

    unfortunately that did not work

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

    Re: Macro to format date correctly

    You are copying column J which has nil values in to column I.
    If you want to copy column I, use this line instead,

    Please Login or Register  to view this content.
    OR use these lines

    Please Login or Register  to view this content.
    Last edited by AB33; 01-26-2016 at 08:18 AM.

  5. #5
    Registered User
    Join Date
    07-20-2015
    Location
    NYC
    MS-Off Ver
    2010
    Posts
    70

    Re: Macro to format date correctly

    One last question. This last tab on the far right's macro, is acting up, can you help?
    When I filter column Q on the yellow tab (Renewal Report) by y and by n its supposed to copy and paste the following columns to the tab in the far right called Report-All
    See illustration below on how whats supposed to be copy where:
    Attached Images Attached Images
    Attached Files Attached Files

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

    Re: Macro to format date correctly

    You have a table, not a range. The code have will not work, it is just hidden by an error trap. See new code on module 3.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    07-20-2015
    Location
    NYC
    MS-Off Ver
    2010
    Posts
    70

    Re: Macro to format date correctly

    See below. When i click on the button to paste the info it should paste these columns. See below
    Attached Images Attached Images
    Attached Files Attached Files

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

    Re: Macro to format date correctly

    I hope I have missed any column.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    07-20-2015
    Location
    NYC
    MS-Off Ver
    2010
    Posts
    70

    Re: Macro to format date correctly

    Almost there. The only thing that needs to be fix, is that it should not be adding extra columns after column I. Can that be done?

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

    Re: Macro to format date correctly

    I do not see where the code is adding any data after column I. It is most likely these data have already been there. Clear all rows and run the code.
    Could you show me with attached sample?

  11. #11
    Registered User
    Join Date
    07-20-2015
    Location
    NYC
    MS-Off Ver
    2010
    Posts
    70

    Re: Macro to format date correctly

    Please see attach
    Attached Files Attached Files

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

    Re: Macro to format date correctly

    You have already got existing data. You need to clear them first and run my code. My code does not clear anything, only populates the data.

  13. #13
    Registered User
    Join Date
    07-20-2015
    Location
    NYC
    MS-Off Ver
    2010
    Posts
    70

    Re: Macro to format date correctly

    Yeah thats what i was afraid of. I need the code to leave things alone, and move these columns only. Not the whole set.
    Attached Images Attached Images

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

    Re: Macro to format date correctly

    I have lost you. The code does not touch any other columns. When you run the code, do you see any data except the above columns? Show me where exactly the extra data are added?

  15. #15
    Registered User
    Join Date
    07-20-2015
    Location
    NYC
    MS-Off Ver
    2010
    Posts
    70

    Re: Macro to format date correctly

    See illustration below. Whats after column I. I circled it in red.
    Attached Images Attached Images

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

    Re: Macro to format date correctly

    I do not understand why keep attaching a picture, instead of an excel workbook. I went the extra length to show you the code on a sample book, but you keep showing me in a picture. I can not see or test the code on pictures. You need to show me in excel book why the code is not working.

  17. #17
    Registered User
    Join Date
    07-20-2015
    Location
    NYC
    MS-Off Ver
    2010
    Posts
    70

    Re: Macro to format date correctly

    i sent the attachment 4 messages ago, and you you said you didnt understand. thats why i sent the picture. here is the attachment once again.
    Attached Files Attached Files

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

    Re: Macro to format date correctly

    Which you code you are running on the attached file? Is it the code on sheet Report - all(copy for Friday report)? The button is attached to a different code.
    You need to manually run the code called Sub you_have_a_table() or attach this code to a button. I keep running this code from my end and still do not see the issue. You have many codes.

  19. #19
    Registered User
    Join Date
    07-20-2015
    Location
    NYC
    MS-Off Ver
    2010
    Posts
    70

    Re: Macro to format date correctly

    I am running Report - all code. And when the button is pressed, what i attached on the prior message is what happens. I copies all rows on the blue tab called Report - all. Its only supposed to copy the columns i mentioned above.

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

    Re: Macro to format date correctly

    As I said, you have many codes. I do not know how are you running these codes, but as far as I am concerned, I run the code directly and I do not see what you are getting. You need to go to the code itself and press f5 to run it and see if the code is right or not. There is only one code on module3, all you have to do is go in to that module and run it.

  21. #21
    Registered User
    Join Date
    07-20-2015
    Location
    NYC
    MS-Off Ver
    2010
    Posts
    70

    Re: Macro to format date correctly

    Understood. See attached. Everything records properly except column G the Report - all tab is pasting the wrong info. Column G on the Report - all should be pasting data from column Q on the yellow tab (Renewal Report).
    Attached Files Attached Files

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

    Re: Macro to format date correctly

    That is not to say the code was posting in columns outside column I. You now seem to accept the code was right, excepting it is copying the wrong column. Yes, I might counted wrong columns.
    Attached Files Attached Files
    Last edited by AB33; 01-27-2016 at 11:14 AM.

  23. #23
    Registered User
    Join Date
    07-20-2015
    Location
    NYC
    MS-Off Ver
    2010
    Posts
    70

    Re: Macro to format date correctly

    I wanted to take the opportunity to thank you for all your help. This looks great. A million thanks again, for everything you've done! You're the best.

+ 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. [SOLVED] Cant format correctly a Pivottable
    By gruzlor in forum Excel Charting & Pivots
    Replies: 6
    Last Post: 02-07-2014, 06:09 PM
  2. Getting Pictures to format correctly
    By ukdjaj in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-31-2014, 05:28 AM
  3. 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
  4. Macro to format not working correctly...
    By misterGwhizz in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-13-2012, 05:21 PM
  5. Macro to format not working correctly...
    By misterGwhizz in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-13-2012, 12:15 PM
  6. Correctly format UK Postcode
    By MikeWaring in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-24-2010, 05:57 AM
  7. Replies: 2
    Last Post: 06-15-2010, 06:05 AM
  8. Date Format Not Copying Back Correctly Onto Userform
    By markrennolds in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-06-2010, 09:01 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