Hello all,
I don't have any experience with the macros programming however I have managed to create the following programme with the help found from older posts here:
I have a spreadsheet with fields for writing down daily expenses so at one of the months (specific worksheet) I want a msgbox to appear with the message ''Happy bday.. etc..'' at an appropriate time. Therefore I have written the following and please advice whether this is a good idea or there are better options:
___________________________________________________________
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Application.EnableEvents = True
If Not Range("E9").Value = 0 Or Not Range("E16").Value = 0 Then MsgBox " Happy Bday!"
If Not Range("E9").Value = 0 Then Range("E9") = Empty
If Not Range("E16").Value = 0 Then Range("E16") = Empty
End Sub
______________________________________________________________
E9-E15 cells are the expenses entries one day before the birthday and E16-E22 are on the day of the birthday: Therefore the user will write down anything on any of the two cells, then the message will appear and immediately after it will be reset.
Now this had been working only at the time of creating the project. I am saving the file as macro-enabled and when I re-open it, it pops the message of security danger (Enable, Disable macros), I click on enable macros but then nothing seems to be working while the code is still there. Any ideas?
Thanks in advance!
I don't have any experience with the macros programming however I have managed to create the following programme with the help found from older posts here:
I have a spreadsheet with fields for writing down daily expenses so at one of the months (specific worksheet) I want a msgbox to appear with the message ''Happy bday.. etc..'' at an appropriate time. Therefore I have written the following and please advice whether this is a good idea or there are better options:
___________________________________________________________
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Application.EnableEvents = True
If Not Range("E9").Value = 0 Or Not Range("E16").Value = 0 Then MsgBox " Happy Bday!"
If Not Range("E9").Value = 0 Then Range("E9") = Empty
If Not Range("E16").Value = 0 Then Range("E16") = Empty
End Sub
______________________________________________________________
E9-E15 cells are the expenses entries one day before the birthday and E16-E22 are on the day of the birthday: Therefore the user will write down anything on any of the two cells, then the message will appear and immediately after it will be reset.
Now this had been working only at the time of creating the project. I am saving the file as macro-enabled and when I re-open it, it pops the message of security danger (Enable, Disable macros), I click on enable macros but then nothing seems to be working while the code is still there. Any ideas?
Thanks in advance!