+ Reply to Thread
Results 1 to 42 of 42

Message box for expired dates from multiple sheets

  1. #1
    Registered User
    Join Date
    01-11-2022
    Location
    Curaçao
    MS-Off Ver
    2016
    Posts
    21

    Message box for expired dates from multiple sheets

    Hello everyone,

    I'm currently doing my internship and my assignment is to create a dashboard for a company of all their certified assets. I have 7 sheets that have multiple tables with certificates and their expire dates. Below you will find an example of one of the many tables:

    Instrument ID Range Serial number Calibration date Expire date Status
    01-003-0006 50-63 1528 14-Aug-2019 14-Aug-2020 Expired
    01-003-0009 200-500 681884 9-May-2019 9-May-2020 Expired
    01-003-0012 50-63 17104 30-Jul-2021 30-Jul-2022 Certified
    01-003-0015 125-150 149664 16-Jul-2020 16-Jul-2021 Expired
    01-003-0018 100-125 150019 16-Jul-2020 16-Jul-2021 Expired
    01-003-0028 100-2100 26234146 19-Jan-2021 19-Jan-2022 About to expire
    01-003-0029 50-63 30762 24-May-2019 24-May-2020 Expired

    The 'Status' column automatically changes to 'About to expire' when the date is 30 days away from expiring.

    Now, I want a pop-up messagebox every time the excel workbook is opened saying which certificate is about to expire and which expired already. See attached picture: msgbox excel example.PNG

    Is there a code in VBA that I can apply for all tables on every sheet? Please let me know.

    Kind regards,
    Caleb

  2. #2
    Registered User
    Join Date
    04-09-2009
    Location
    Larache ,Morocco
    MS-Off Ver
    Office 2016 64bit - Windows 10 64bit
    Posts
    4

    Re: Message box for expired dates from multiple sheets

    I would use Conditional Formatting instead of displaying a MsgBox ...It is easier to set up plus visually easier to spot the cells involved ... Just imagine how many MsgBoxes you would end up with each time you open the workbook if there happens to be a lot of cells showing "expired" or "about to expire" . It would quickly get out of control.

  3. #3
    Registered User
    Join Date
    01-11-2022
    Location
    Curaçao
    MS-Off Ver
    2016
    Posts
    21

    Re: Message box for expired dates from multiple sheets

    I completely agree with you. I already did conditional formatting. The status column changes highlight color depending on the status. But my internship supervisor insists on the message box. That's why I can not just forget about the idea.

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,148

    Re: Message box for expired dates from multiple sheets

    If CF not suitable then produce reports showing "About to Expire" and "Expired": this can be done with formula.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  5. #5
    Registered User
    Join Date
    01-11-2022
    Location
    Curaçao
    MS-Off Ver
    2016
    Posts
    21

    Re: Message box for expired dates from multiple sheets

    Could you give me an example?

  6. #6
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Message box for expired dates from multiple sheets

    Make sure that the workbook has two sheets named "Expired" and "About to expire". Place this macro in the code module for ThisWorkbook. Do the following: Hold down the ALT key and press the F11 key. This will open the Visual Basic Editor. In the left hand pane, double click on "ThisWorkbook". Copy/paste the macro into the empty window that opens up. Close the window to return to your sheet. Save the workbook as a macro-enabled file. Close it and then re-open it and the reports will be created.

    Please Login or Register  to view this content.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  7. #7
    Registered User
    Join Date
    01-11-2022
    Location
    Curaçao
    MS-Off Ver
    2016
    Posts
    21

    Re: Message box for expired dates from multiple sheets

    Thank you for your reply. Can you explain me why I need two sheets named "Expired" and "About to expire"? Do I need to place any information in these sheets?

  8. #8
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Message box for expired dates from multiple sheets

    Since you have 7 sheets and most likely will have many items that have expired or are about to expire, using message boxes would not be very efficient. It would be easier to create two reports, one on the "Expired" sheet and one on the "About to expire" sheet. The two sheets can be blank. Each time you open the file, the reports will be updated.

  9. #9
    Registered User
    Join Date
    01-11-2022
    Location
    Curaçao
    MS-Off Ver
    2016
    Posts
    21

    Re: Message box for expired dates from multiple sheets

    Okay I understand now. Can you tell me which values I would have to change in the code if my 'Status' column starts at cell G15?

  10. #10
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Message box for expired dates from multiple sheets

    Are your headers in row 14? It would be easier to help and test possible solutions if you could attach a copy of your file (de-sensitized if necessary). See the yellow banner at the top of this page for instructions to attach a file.

  11. #11
    Registered User
    Join Date
    01-11-2022
    Location
    Curaçao
    MS-Off Ver
    2016
    Posts
    21

    Re: Message box for expired dates from multiple sheets

    Okay give me a few minutes and I will attach it.

  12. #12
    Registered User
    Join Date
    01-11-2022
    Location
    Curaçao
    MS-Off Ver
    2016
    Posts
    21

    Re: Message box for expired dates from multiple sheets

    Here is a de-sensitized copy of the dashboard. Let me know if there is anything else I need to provide.
    Attached Files Attached Files

  13. #13
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Message box for expired dates from multiple sheets

    Many of your sheets have more than one table which include a "Status" column but no certificate numbers (Instrument ID). In your original post you said that you wanted to return the certificate number (Instrument ID). How do you want to handle this situation?

  14. #14
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,148

    Re: Message box for expired dates from multiple sheets

    Made life difficult as it appears every sheet has the "Status" in different ranges!!!

  15. #15
    Registered User
    Join Date
    01-11-2022
    Location
    Curaçao
    MS-Off Ver
    2016
    Posts
    21

    Re: Message box for expired dates from multiple sheets

    Yes I know. Most sheets have multiple tables. Most of the first tables do have the status column in the 'G' column. If not, is there a way where I can just copy paste a code for every table and just change some values according to the table?

  16. #16
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Message box for expired dates from multiple sheets

    A macro can still handle the multiple tables. However, could you please respond to my question in Post#13 regarding the tables with no certificate numbers (Instrument ID)?

  17. #17
    Registered User
    Join Date
    01-11-2022
    Location
    Curaçao
    MS-Off Ver
    2016
    Posts
    21

    Re: Message box for expired dates from multiple sheets

    Oh my bad I did not see that question. Yes that is correct. I want to link it with their instrument ID. The tables that do not have an instrument ID are the welding machines of the sheet 'Pipefitters' and 'Steel shop', Magnet from the sheet 'Steel shop' and transport. Let the serial number of the welding machines act as their instrument ID (in the file I sent you they have the same serial numbers but in the actual dashboard all serial numbers are unique). The crane # can act as the 'instrument ID' in the table of cranes in the 'Transport' sheet. Don't worry with the table of crane/forklift operators for now.

    Let me know if I missed anything.

  18. #18
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,860

    Re: Message box for expired dates from multiple sheets

    crossposted: https://www.mrexcel.com/board/thread...dates.1192422/

    Rule 03: Cross-posting Without Telling Us

    Your post does not comply with Rule 3 of our Forum RULES. Do not cross-post your question on multiple forums without telling us about your threads on other forums.

    Post a link to any other forums where you have asked the same question.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Read this to understand why we ask you to do this.

    I have added the crosspost reference for you today. Please comply with this and all our rules in the future
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  19. #19
    Registered User
    Join Date
    01-11-2022
    Location
    Curaçao
    MS-Off Ver
    2016
    Posts
    21

    Re: Message box for expired dates from multiple sheets

    Yes sorry I posted this question on another forum but did not get any feedback. I appreciate the feedback I am receiving on this forum. I tried uploading the link but I am getting the following error: "You are not allowed to post any kinds of links, images or videos until you post a few times." How should I proceed?

  20. #20
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Message box for expired dates from multiple sheets

    The sheet 'Pipefitters' has no data in the "Serial number" column in the Pr Gauge table. As well, some tables use "Serial number" as the header while others use "Serial nr." as the header. These things complicate matters because macros depend on regular and consistent patterns. Can the serial number instead of the instrument ID be used on all the tables?

  21. #21
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: Message box for expired dates from multiple sheets

    Yes sorry I posted this question on another forum but did not get any feedback.
    You actually posted on the other forum AFTER you posted here & AFTER you had already received responses here.

  22. #22
    Registered User
    Join Date
    01-11-2022
    Location
    Curaçao
    MS-Off Ver
    2016
    Posts
    21

    Re: Message box for expired dates from multiple sheets

    Yes correct because they do not have serial numbers, or the company does not know the serial numbers. For that reason I don't think we can use serial number instead of instrument ID.
    The headers is a type error from me, all should just be "Serial number".

  23. #23
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Message box for expired dates from multiple sheets

    How do we handle the tables with no certificate numbers (Instrument ID)?

  24. #24
    Registered User
    Join Date
    01-11-2022
    Location
    Curaçao
    MS-Off Ver
    2016
    Posts
    21

    Re: Message box for expired dates from multiple sheets

    I am not familiar with how macro's work in Excel, but is it possible to create a different macro for these tables? For example the welding machine tables we use the serial number as the instrument ID? And the crane table we use crane #?

    Let me know if this is possible.

  25. #25
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Message box for expired dates from multiple sheets

    To be honest I really don't have time to suggest a different macro for each table. That would be very time consuming. My suggestion would be to try to modify all the tables so that they contain the same format. Sorry.

  26. #26
    Registered User
    Join Date
    01-11-2022
    Location
    Curaçao
    MS-Off Ver
    2016
    Posts
    21

    Re: Message box for expired dates from multiple sheets

    Okay I understand. Can you leave those out then and only write a macro for the tables with the instrument ID in them?

    I am not sure how I would have to modify the other tables so that they all have the same format.

  27. #27
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Message box for expired dates from multiple sheets

    Is it possible to insert a column with the instrument ID in those tables that don't have the instrument ID?

  28. #28
    Registered User
    Join Date
    01-11-2022
    Location
    Curaçao
    MS-Off Ver
    2016
    Posts
    21

    Re: Message box for expired dates from multiple sheets

    We can insert a column, but some assets just don't have an instrument ID. So the column would stay blank. Or I would have to give them a 'fake' instrument ID.

  29. #29
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Message box for expired dates from multiple sheets

    Can you just insert "No instrument ID" in those cells so they are not empty? If you can, please make the changes and attach the revised file.

  30. #30
    Registered User
    Join Date
    01-11-2022
    Location
    Curaçao
    MS-Off Ver
    2016
    Posts
    21

    Re: Message box for expired dates from multiple sheets

    Okay I did some changes. Let me know if they're good.
    Attached Files Attached Files

  31. #31
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Message box for expired dates from multiple sheets

    Give me a little time and I'll see what I can do.

  32. #32
    Registered User
    Join Date
    01-11-2022
    Location
    Curaçao
    MS-Off Ver
    2016
    Posts
    21

    Re: Message box for expired dates from multiple sheets

    Thank you! I appreciate the time you're putting in.

  33. #33
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Message box for expired dates from multiple sheets

    Try the attached file. Please note that I have had to make modifications. I moved the Instrument ID column in each table so that it is next to the Status column. I corrected some typo's where many of the headers had a trailing space that had to be removed. Also, one or two of the sheets did not have the headers in row 14. There were a few other issues as well. Please note that if you try the macro on a different workbook, it most likely will not work. You have to use the attached version of the file. The macro will run when you open the file. You should be aware that you can also run the macro manually.
    Attached Files Attached Files

  34. #34
    Registered User
    Join Date
    01-11-2022
    Location
    Curaçao
    MS-Off Ver
    2016
    Posts
    21

    Re: Message box for expired dates from multiple sheets

    Thank you for your reply. However, it is not working by me. I am receiving an error with 'macro 1':

    "Run-time error '1004':
    Autofilter method of Range class failed" See attached picture for the error".

    With the second macro, I do not see the report. See the other attached picture to see what I mean.
    Let me know if it's something that I am doing wrong or that I need to enable.
    Attached Images Attached Images

  35. #35
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Message box for expired dates from multiple sheets

    My apologies. I forgot to delete Modules 1 and 2. I was using them for testing and they are not necessary. Please delete both modules. The macro is in the code module for ThisWorkbook. To see the macro, hold down the ALT key and press the F11 key. This will open the Visual Basic Editor. In the left hand pane, double click on "ThisWorkbook". You can run this macro manually at any time but it also runs automatically when you open the file.

  36. #36
    Registered User
    Join Date
    01-11-2022
    Location
    Curaçao
    MS-Off Ver
    2016
    Posts
    21

    Re: Message box for expired dates from multiple sheets

    Okay just to be clear, after pressing ALT + F11, delete the 'Sub Macro1() and Macro 2()"?

  37. #37
    Registered User
    Join Date
    01-11-2022
    Location
    Curaçao
    MS-Off Ver
    2016
    Posts
    21

    Re: Message box for expired dates from multiple sheets

    Nevermind, I deleted the macro's and now it's working. Thank you very much! All though, I still have the problem where my Home sheet changes and deletes some shapes. See attached picture. Would you know what is the cause of this?
    Attached Images Attached Images

  38. #38
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Message box for expired dates from multiple sheets

    The macro I suggested has no effect on anything on the "Home" sheet. Are you running any other code?

  39. #39
    Registered User
    Join Date
    01-11-2022
    Location
    Curaçao
    MS-Off Ver
    2016
    Posts
    21

    Re: Message box for expired dates from multiple sheets

    Yes I am running a code that I found online so that whenever the Workbook is opened, it will always open on the Home sheet:
    Private Sub Workbook_Open()
    Dim xOWSName As String
    Dim xWS As Worksheet
    xOWSName = "Home"
    Set xWS = Worksheets(xOWSName)
    xWS.Activate
    End Sub

    I can not find it in the code however but I remember putting it in. Would this code affect it?

  40. #40
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Message box for expired dates from multiple sheets

    You don't need that code. If you look at the code I suggested, you will see a line of code that I have included near the top that activates the "Home" sheet:
    Please Login or Register  to view this content.
    That would not be the cause of the problem.

  41. #41
    Registered User
    Join Date
    01-11-2022
    Location
    Curaçao
    MS-Off Ver
    2016
    Posts
    21

    Re: Message box for expired dates from multiple sheets

    Okay I think after deleting the first two macros, I solved the issue. Once again, thank you very much for your time. I highly appreciate it!

  42. #42
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Message box for expired dates from multiple sheets

    You are very 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] Sales Report that looks @ Start dates and Expired dates
    By pmw19800 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-06-2020, 04:34 AM
  2. Replies: 1
    Last Post: 03-25-2020, 04:00 PM
  3. [SOLVED] Nested If Functions for Upcoming Expiration Dates and Expired Dates
    By AmberLeanne in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-12-2017, 07:33 PM
  4. [SOLVED] Expired dates
    By thursday140 in forum Excel General
    Replies: 2
    Last Post: 10-11-2017, 07:40 AM
  5. Replies: 1
    Last Post: 09-26-2016, 10:23 AM
  6. The trial license on this computer has expired error message
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 09-12-2014, 05:27 AM
  7. [SOLVED] Expired Dates
    By Axel in forum Excel General
    Replies: 6
    Last Post: 11-23-2005, 09:55 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