Search code examples
messagecountingbox

Counting result base on value in Message Box


I am looking for help to teach me how to create message box base on this

value:
=IF(F2<=TODAY(), "EXPIRED", IF(AND(F2-TODAY()>0, F2-TODAY()>=10), "ACTIVE", "REMINDER"))

I wish the message box will appear once I open the excel file which all under 'Reminder" only with a number. The message box will be such as "32 Reminder found in XLMembership" base on counting result.


Solution

  • Since no one interesting to answer my question then I answer it myself and sharing to user who looking an answer on same question..

    Private Sub Workbook_Open()
    Dim Ret_type As Integer
    Dim strMsg As String
    Dim strTitle As String
    Dim iReminders As Long
    
    iReminders = WorksheetFunction.CountIf(Columns("B"), "REMINDER")
    MsgBox Format(iReminders, "#,##0") & " REMINDER found in XLMembership", vbInformation + vbOK 
    
    End Sub