+ Reply to Thread
Results 1 to 18 of 18

Sort date and bring current date top and run macro

  1. #1
    Forum Contributor
    Join Date
    12-15-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    672

    Sort date and bring current date top and run macro

    Hi friends,
    There are several contacts in my directory and daily only 1-2 birthdays or sometimes not a single birthday. The anniversary macro searchhhes for a person whose birthday is on that particular date and send automatic email to him. For it the macro has to run till last entry in my directory that means about 1000 or more entries. It takes a lot of time to send 1-2 mails. I want to sort out the date after opening the file first and bring the current date on top and the anniversary macro should run only for that current date and then stop. For it I inserted a sortdata macro but it sorts the dates in ascending order and not bring the current dates on top.

    Requirements:

    After opening the file the sortdata macro should run first and bring the current dates on top.
    Then the anniversary macro should run only for that current dates and stop

    This will save my time and speed up the task.

    Please help me to solve this problem.

    Thanking you in anticipation.

    Mukesh
    Attached Files Attached Files

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Sort date and bring current date top and run macro

    Hi Mukesh

    Why not Filter on the Date?
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Forum Contributor
    Join Date
    12-15-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    672

    Re: Sort date and bring current date top and run macro

    Hi John,
    Thank you for suggestion. I liked it and created a macro for date filter but it's not working as per my requirement. Please go through it and give me a solution.

    Now it's filtering the today's date but while running the anniversary macro it scrolls all the date in column 't' which I don't want. I want to send the mails to filtered dates 'today' only and save the time to perform the action.

    Thank you.

    Mukesh
    Attached Files Attached Files
    Last edited by mukeshbaviskar; 10-06-2013 at 11:24 PM. Reason: Attach a modified attachment

  4. #4
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Sort date and bring current date top and run macro

    Hi Mukesh
    I tested the code and probably sent you a few emails, sorry
    Try
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    12-15-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    672

    Re: Sort date and bring current date top and run macro

    Hi Nilem,
    Oh! What a excellent creation. You have done a great job to combine three macros in a single one. It's working fine. I want to add the message at the end of macro as follows:

    If there is no birthday then the message should pop up as:

    "No birthday today!"

    After sending all the mails the message should pop up as:

    "Finish sending mails!"

    In short if there is no birthday then the first message should pop up and if the birthday message is sent then the second pop up message should pop up. That mean only one of these pop up message should pop up after completing the macro.

    Please tell me how to add beep sound after pop up the message which you have done. I want to add it in my other macros.

    Please modify it and then the problem will be solved.

    Don't mind of the mails sent to me while testing. You have tested it for me only.

    Thank you and good night.

    Mukesh
    Attached Files Attached Files

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Sort date and bring current date top and run macro

    Hi Mukesh

    I've rewritten the Code to incorporate the Filter
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    12-15-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    672

    Re: Sort date and bring current date top and run macro

    Good morning John,
    Oh! What a excellent creation. You also have done a great job to combine three macros in a single one. It's working fine. I want to add the message at the end of macro as follows:

    If there is no birthday then the message should pop up as:

    "No birthday today!"

    After sending all the mails the message should pop up as:

    "Finish sending mails!"

    In short if there is no birthday then the first message should pop up and if the birthday message is sent then the second pop up message should pop up. That mean only one of these pop up message should pop up after completing the macro.

    After completing the task the auto filter should be disable.
    Please do these 3 amendments in the code and then the program will be complete.
    Now I have disable auto filter after completing the task but unable to write a code to these two messages. Please check whether I have written the code correctly or not.

    Thank you.

    Mukesh
    Attached Files Attached Files
    Last edited by mukeshbaviskar; 10-08-2013 at 12:18 AM. Reason: Attach a modified file

  8. #8
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Sort date and bring current date top and run macro

    Hi Mukesh
    try
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    12-15-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    672

    Re: Sort date and bring current date top and run macro

    Hello Nilem,
    Thank you. It's working fine as per my desire but only one little problem is there. See contact no. 5 Mrs. turco Sally for example. There is no email id and the message pop up "Sally Turco's birthday today and has empty email address" and after this again the message pop up "No birthday today" which is not required here because there is a birthday of a person and only he has no email id. At this situation the macro should run and stop. No need to pop up the wrong message "No birthday today"

    Please amend it positively.

    I didn't understand the numbers '48 and 64' in the code message. What is the meaning of these numbers here. Secondly how to add beep sound before the pop up message as you did in the code.

    Thank you.

    Mukesh

  10. #10
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Sort date and bring current date top and run macro

    Okay, I sent two more letters to you
    Please Login or Register  to view this content.
    64 and 48 are constants of the Buttons argument of MsgBox Function (see help VBA)

  11. #11
    Forum Contributor
    Join Date
    12-15-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    672

    Re: Sort date and bring current date top and run macro

    Hi Nilem,
    Sorry for trouble. I have finalize the first code you have provided. I have following problems in it.

    The name of first two contacts is not displaying.
    I have changed the macro completion message in the code as:
    "The task completed successfully!"
    To avoide confusion.
    Please check it.
    I'm getting error while sending mail as follows:

    A program is trying to send an email message on your behalf. If this is unexpected, click deny and verify your anti virus software up to date.
    For more information about email safety and how you might be able to avoid getting this warning click help.
    Allow Deny Help.

    Please go through it and solve my problems to complete this lengthy thread positively.

    Sorry and thank you for your valuable guidance to achieve my target easily.

    Mukesh
    Attached Files Attached Files

  12. #12
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Sort date and bring current date top and run macro

    Mukesh, I sent a test email to you. Did you get it?
    I think the problem comes from the fact that you're trying to send a mail to your address.
    Please enter a different email address (for example, my email ) in column Z and try again.

  13. #13
    Forum Contributor
    Join Date
    12-15-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    672

    Re: Sort date and bring current date top and run macro

    Hi Nilem,
    Thank you. I received your test mail. As per your suggestion I changed the email address but the same error occur.

    Please look into my other problems mentioned in last thread.

    Waiting to close this thread today with your solution.

    Thank you and good night.

    Mukesh

  14. #14
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Sort date and bring current date top and run macro

    Mukesh, unfortunately I do not know how to solve your problem. Maybe the reason is your Outlook settings?
    Try the code that wrote Jaslake (post #6). Are there any problems you have with this code?

  15. #15
    Forum Contributor
    Join Date
    12-15-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    672

    Re: Sort date and bring current date top and run macro

    Hi Nilem,
    Sorry for trouble. I have finalize the first code you have provided. I have following problems in it.

    The name of first two contacts is not displaying.
    I have changed the macro completion message in the code as:
    "The task completed successfully!"
    To avoide confusion.
    Please check it.
    I have solved the problem of error message by changing the setting of outlook and now it's working fine. The mails are being delivered automatically without any error.

    I need some revision in John's code like you have done in your code. It didn't require any change in outlook setting trust center. It's fine but I don't know how to do the amendments in it to meet my requirement. So I finalize this code no any problem. He has also done a great job and I'm thankful to him.

    I request you to do the above mentioned amendment in the code and close the thread today positively.

    Waiting eagerly to receive a final revision to complete this program.

    Thank you very much.

    Mukesh

  16. #16
    Forum Contributor
    Join Date
    12-15-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    672

    Re: Sort date and bring current date top and run macro

    Hi Nilem,
    Sorry for trouble. I have finalize the first code you have provided. I have following problems in it.

    The name of first two contacts is not displaying.
    I have changed the macro completion message in the code as:
    "The task completed successfully!"
    To avoide confusion.
    Please check it.
    I have solved the problem of error message by changing the setting of outlook and now it's working fine. The mails are being delivered automatically without any error.

    I need some revision in John's code like you have done in your code. It didn't require any change in outlook setting trust center. It's fine but I don't know how to do the amendments in it to meet my requirement. So I finalize this code no any problem. He has also done a great job and I'm thankful to him.

    I request you to do the above mentioned amendment in the code and close the thread today positively.

    Waiting eagerly to receive a final revision to complete this program.

    Thank you very much.

    Mukesh

  17. #17
    Forum Contributor
    Join Date
    12-15-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    672

    Re: Sort date and bring current date top and run macro

    Hi Nilem,
    Oh! What a silly mistake I have done. The concatenate formula in first 2 row was missing so the names are not displaying. I have inserted the formula and the problem is solved. Now all my problems are solved.

    Thank you to you and John for helping me to solve this problem. The program is working fine.

    Mukesh

  18. #18
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Sort date and bring current date top and run macro

    Hi Mukesh
    You are welcome!

+ 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] Sort Rows by Date & Only Show Rows After Current Date
    By rwatson in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-23-2013, 01:58 PM
  2. [SOLVED] Need average of days for date values from date to current day that updates current date
    By FinGhost in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-12-2013, 04:41 PM
  3. Macro doesn't work if fx run on different date from the current date
    By santhisrinivas in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-11-2012, 01:08 PM
  4. adding current date then after saving the file current date function stops
    By gotbitey in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-21-2011, 02:15 PM
  5. create macro to delete row with a date previous to current date
    By laserk7 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-25-2008, 12:36 PM

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