How to auto add comments based on date on separate sheet

  • Hi there, I have a file used to track quantities based on dates. The file has three sheets: "2018", "2019" and "Events". Need the events in the "Events" sheet to auto populate comments in the corresponding "2018" or "2019" sheets based on the dates. For example:


    "Events" A3 - Event 1 should be placed in "2018" A3. This is because the date in "2018" B3 matches the date in "Events" B3.
    "Events" A4 - Event 2 should be placed in "2018" D3. This is because the date in "2018" E3 matches the date in "Events" B4.
    "Events" A5 - Event 3 should be placed in "2018" G3. This is because the date in "2018" H3 matches the date in "Events" B5 and so forth.


    Thank you in advance for your help.

  • Are the dates in the "Events" sheet always consecutive and sorted from oldest to newest?

    You can say "THANK YOU" for help received by clicking the "Like" icon in the bottom right corner of the helper's post.
    Practice makes perfect. I am very far from perfect so I'm still practising.

  • Yes, the events are sequenced based on their dates, oldest to newest. All the events in the "Events" sheet should be added as a comment on the other sheets.

  • Try this macro. Because the "Events" sheet contains years 2018 to 2020, you will either have to add a 2020 sheet or delete column D. Otherwise the macro will generate an error.

    You can say "THANK YOU" for help received by clicking the "Like" icon in the bottom right corner of the helper's post.
    Practice makes perfect. I am very far from perfect so I'm still practising.

  • Thank you Mumps for getting a solution so quickly.. I tried the code and noticed the comments are added to row 3 only in the 2018, 2019 and 2020 sheets. Is there a way the comments can actually be placed in the Day cell corresponding to the Event date? The calendar is setup in a vertical way. I'm attaching my test file in case you need it.

  • Try:

    You can say "THANK YOU" for help received by clicking the "Like" icon in the bottom right corner of the helper's post.
    Practice makes perfect. I am very far from perfect so I'm still practising.

  • Thank you Mumps for the updated code. That did the trick. I have one last question. Just realized that some events may have the same date. If that is the case, is there a way to append or concatenate both events in the same comment?

  • Try:

    You can say "THANK YOU" for help received by clicking the "Like" icon in the bottom right corner of the helper's post.
    Practice makes perfect. I am very far from perfect so I'm still practising.

  • Thank you Mumps. Unfortunately, the updated code did not work. Only one event appears in the comment box. What can I do to merge events with the same date?

  • Try:

    You can say "THANK YOU" for help received by clicking the "Like" icon in the bottom right corner of the helper's post.
    Practice makes perfect. I am very far from perfect so I'm still practising.

  • That is great Mumps. Worked like a charm. Thank you so much. I noticed that you used the LookIn:=xlFormulas string. What if the 2018 and other year worksheets use formulas to fill the calendar days? See attached file. I'm using the formulas to make it easy to auto create the calendar with just entering the first of the year in 2018 A1 and so forth. Your code above does not work if I use the formulas.


    Thank you again for all the help with this request.

  • Hi Mumps, I see the problem. Please use the latest file I uploaded on this post. It should have two modules. The first module contains your code with the cases. The second module contains the code to merge events with the same date. This code does not work if the calendar dates in the 2018, 2019 and 2020 are based on formulas. Hopefully, you can replicate the issue on your end.
    Thank you

  • I don't quite understand. The code in the file you attached in Post #11 doesn't work as you said, but I tried the code below and it does work. Is it not working for you?


    You can say "THANK YOU" for help received by clicking the "Like" icon in the bottom right corner of the helper's post.
    Practice makes perfect. I am very far from perfect so I'm still practising.

  • Your latest code works if the dates in the "Day" columns are manually entered. For example 01/01/2018. However, if I use formulas to calculate the dates then the code does not work. If each cell in the "Day" columns have formulas the code does not work.

  • Could you please attach a copy of the file that is not working. De-sensitize it if necessary.

    You can say "THANK YOU" for help received by clicking the "Like" icon in the bottom right corner of the helper's post.
    Practice makes perfect. I am very far from perfect so I'm still practising.

  • Hi Mumps, I'm attaching the file as requested. The file only has one module with your latest code to merge comments if they have the same date. I highlighted the events with the same date in the Events sheet. I also made a note in the 2018 sheet to show that the dates in the Date columns are based on formulas. The formulas are there to make it easier to fill the calendar based on the year.
    Once again, thank you so much for your help on this project.

  • Try:

    You can say "THANK YOU" for help received by clicking the "Like" icon in the bottom right corner of the helper's post.
    Practice makes perfect. I am very far from perfect so I'm still practising.

  • My pleasure. :)

    You can say "THANK YOU" for help received by clicking the "Like" icon in the bottom right corner of the helper's post.
    Practice makes perfect. I am very far from perfect so I'm still practising.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!