Hmm, it worked for me. I made the changes to Kaper's code as discussed:
I don't work with events, but to test it, I went into the Worksheet, in my case, I used Sheet3. I double clicked on sheet3 in the project pane, chose worksheet from the dropdown menu, and located the change event, and pasted code. I didn't need to do that last step, and if I hadn't, I would not have had to then delete the now redundant first and last lines. But as I say, I don't work with events, so I wante3 to make doubly sure I was putting the code in the right place.
I then made some changes to a cell in the range of a1:a100 and either today's date appeared (if value was over 300 or if less then 300, data was erased.
|
A |
B |
1 |
Num |
Date? |
2 |
307 |
5/9/2014 |
3 |
7 |
|
4 |
300 |
|
5 |
356 |
5/9/2014 |
6 |
b |
|
7 |
777 |
5/9/2014 |
8 |
66 |
|
Okay, I actually made a couple other small changes. 1, changed range to start from A2 so I could use a header in A1:B1, and, I noticed when I used a letter, "b", it put in date. I don't know if b is > 300, but I added an Isnumeric test:
By the way, I got curious as to whether that was a valid way of putting a date in a cell. It appears it is via Immediate Pane:
? isdate(cells(5,2))
True
Sorry, I missed the 1st step that Kaper posted:
Right click on sheet tab and paste changed version of above code:
That's much easier than what I described. And I learned something new.
Bookmarks