Message Box to show expiry dates, when work book opens up

chiswickbridge

Board Regular
Joined
Feb 2, 2013
Messages
130
Hi Guys,


I have a database with Passport and License Details, with expiry dates.
I have conditional Formatting in a certain column to show the dates that are about to expire within the next 15 or 30 days.


And cells A1 in both sheet show ALARM or NONE to indicate that there are some expiry dates close to my criterea by using Today()+30 or 15.


But the Workbook has 100 sheets and at times I forget to access these pages.




Cell A1 in Sheet1 and Cell A1 in Sheet2, have a value either ALARM or NONE.


Need a VBA when WorkbookOpens, to show a message box with the following message :


Sheet1 has ALARM
Sheet2 has NONE or


Sheet1 has NONE
Sheet2 has ALARM or any combination.


The message box to contain just a OK button to acknowledge.


And the Workbook opens to default sheet1


I can later tweak it to add more sheets...


Any help...
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Try this macro in the code module for ThisWorkbook:
Code:
Private Sub Workbook_Open()
    Application.ScreenUpdating = False
    Dim msg As String
    Dim ws As Worksheet
    For Each ws In Sheets
        msg = msg & Chr(10) & ws.Name & " has " & CStr(ws.Range("A1"))
    Next ws
    Application.ScreenUpdating = True
    MsgBox msg
End Sub
 
Upvote 0
Thank MUMPS.... Great...

However one request....

Is it possible that I create one Worksheet called Alarm_Records, and starting from Cells A1 to A100....the cell value gets the data instead of the Flash Screen and the workbook open to this Worksheet Alarm_Records. The Alarm data gets erased and fresh data is input the next time I open the Workbook
 
Upvote 0
Try:
Code:
Private Sub Workbook_Open()
    Application.ScreenUpdating = False
    Sheets("Alarm_Records").Range("A2:A" & Sheets("Alarm_Records").Range("A" & Sheets("Alarm_Records").Rows.Count).End(xlUp).Row).ClearContents
    Sheets("Alarm_Records").Range("A1") = "Alarm Records"
    For Each ws In Sheets
        If ws.Name <> "Alarm_Records" Then
            Sheets("Alarm_Records").Cells(Sheets("Alarm_Records").Rows.Count, "A").End(xlUp).Offset(1, 0) = ws.Name & " has " & CStr(ws.Range("A1"))
        End If
    Next ws
    Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

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