Check a value every time excel is loaded

  • Thread starter Thread starter Subodh
  • Start date Start date
S

Subodh

I will get an example to demonstrate my problem.
I have worksheet with data in range A1 to A100 and B1 to B100
Lets say it shows the todays date in A1 to A100 and due date for
paying bill in range B1 to B100 for grocery, phone etc.
If the due date is today (ie A1 = B1) then the excel should
show a message. But, I would like to do that without opening the excel
file.
The problem is to check the values in those cells each time
excel loads (preferably by loading an Addin) and then display a
message if the specified criteria is met.
Thanks in advance.
 
Just keep the file hidden - though you will need to unhide it to enter new values. Store it in your default XLStart folder so that it is opened, or save it as an add-in and install it.
You can use the workbook open event - put you don't need today's date in column A, though you could put some identifying string in column A, with the due date in column B. Copy the code into the ThisWorkbook object's codemodule.

Bernie

Private Sub Workbook_Open()
Dim i As Long
For i = 1 To Cells(Rows.Count, 1).End(xlUp).Row
If Date = Cells(i, 2).Value Then
MsgBox "Pay the bill: " & Cells(i, 1).Value
End If
Next i
End Sub
 
Back
Top