Check Expiry dates from multiple sheets with a pop up box

Kjjb

New Member
Joined
Dec 26, 2022
Messages
13
Office Version
  1. 365
Platform
  1. Windows
Hi ,
Surely there must be a thread for my query , but cannot seem to find it .Appreciate your help.
I have a worksheet with 4 sheets named "D1D","D2D","D3D","Misc" . I need to write a VBA to check all the 4 sheets for expiry date ( today()-30) in column E ( range E 7:E135) and then pop message should state Certificates have expired. The pop up box/check should be done when I open the workbook.
Appreciate your help.

Thanks in advance
 
Small revision:
VBA Code:
Private Sub Workbook_Open()
  Dim wsNames() As string
  wsNames = Split("D1D,D2D,D3D,Misc ,Various", ",") 'You must add the sheet names you want into this list.
  For i = 0 To UBound(wsNames)
    With Worksheets(wsNames(i))
      For j = 7 to 135
        If IsDate(.Cells(j, 5).Value) Then
          If .Cells(j, 5).Value > Now()-30 Then
            MsgBox "Sheet " & wsNames(i) & " Date E" & j & " has expired."
          End If
        End If
      Next
    End With
  Next
End Sub
 
Upvote 0
Solution

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Small revision:
VBA Code:
Private Sub Workbook_Open()
  Dim wsNames() As string
  wsNames = Split("D1D,D2D,D3D,Misc ,Various", ",") 'You must add the sheet names you want into this list.
  For i = 0 To UBound(wsNames)
    With Worksheets(wsNames(i))
      For j = 7 to 135
        If IsDate(.Cells(j, 5).Value) Then
          If .Cells(j, 5).Value > Now()-30 Then
            MsgBox "Sheet " & wsNames(i) & " Date E" & j & " has expired."
          End If
        End If
      Next
    End With
  Next
End Sub
EXCELLENT ..works perfectly.. THANK YOU VERY MUCH
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,313
Members
452,634
Latest member
cpostell

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