How to make msgbox display total found

malaya tigre

New Member
Joined
Apr 6, 2017
Messages
12
Hi..

I got this formula in B column which calculating value on F column...
=IF(F2<=TODAY(), "EXPIRED", IF(AND(F2-TODAY()>0, F2-TODAY()>=10), "ACTIVE", "REMINDER"))

By using VBA code, how can i have a message box that tell me such like "62 REMINDER found to update"?

Thanks..
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
This will do the job:-
Code:
Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)

  Dim iReminders As Long
  
  iReminders = WorksheetFunction.CountIf(Columns("B"), "REMINDER")
  
  MsgBox Format(iReminders, "#,##0") & " REMINDER found to update", vbInformation + vbOKOnly

End Sub

Put this in the code module for the worksheet your data is in. It will fire every time anything in your worksheet changes. Get that working first and then decide whether that's actually too often and if so, we can look at it again.
 
Last edited:
Upvote 0
Hi,

Hope this helps:

Code:
Sub Expired_Left()

    MsgBox WorksheetFunction.CountIf(Range("B2:B" & Range("B10000").End(xlUp).Row), "REMINDER") & " REMINDERS found to update"
    
End Sub

Best regards,
Mart
 
Last edited:
Upvote 0
how you might trigger it I haven't shown

Sub test()
MsgBox "62 REMINDER found to update", vbOKOnly, Application.Name
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,271
Members
452,628
Latest member
dd2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top