Hi Everyone
So I have a Macro that is only executed when a certain cell value is changed. In my case its (Cell M2) in (sheet 2).
The value in (Cell M2) is the current year, I used the function =YEAR(NOW()). I want my SaveMe1 macro to run every time a new year begins, aka when the the value in cell M2 changes. I am assuming since I am using the function =YEAR(NOW()), when the next year rolls around it will give me the new year, seeing that it gives me the current year right now.
PS: I checked the formatting on it and its general, not date or Text or integer., I even did a quick MsgBox Cells(2, "M") and I get 2013 as a pop display. So far so good.
For the purpose of testing, since I cant wait an year to see if it actually works, I changed the year function namely, =YEAR(NOW()) to minute function namely, =MINUTE(NOW()). I get my minutes displayed in cell and once again it is formatted as general. I close the workbook and reopen after a few minutes have gone by, and as expected the new minute shows up, but to my disappointment the macro does not get executed.
now I tried placing the Worksheet_change macro in my ThisWorkbook, nothing
I tried placing the macro in my sheet2 ,once again nothing. Also The macro that i want to execute is saved under one of the modules.
Here is the code
Option Explicit
I tried the following heading and code
And then I tried the following![]()
Private Sub Worksheet_Change(ByVal Target As Range) Select Case Target.Address Case "$M$2" 'Insert your code here Call SaveMe1 Case Else End Select
Not sure if there is a difference.![]()
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) Select Case Target.Address Case "$M$2" 'Insert your code here Call SaveMe1 Case Else End Select End Sub
I would appreciate your assistance, I am really frustrated.
Hopefully I was clear, if not please let me know. Eagerly looking forward to your replies.
Regards
Angsome
Bookmarks