[/PHP]PHP Code:
I am trying to put in an active-X control button with a macro to check a date then change a date.
- below is a basic version of what I am trying to accomplish and I will be able to expand it out once I get the first one solid.
- I have a spread sheet that I track inspections for work on the intervals of 7, 14, 28, 56, 112 and 224. Obviously the 7 day inspection occurs every 7 calendar days and the 14 every 14 calendar days (twice a month) and so on...
- I have been hard entering all these dates but with the growing amount of gear I have it will be easier to just enter a set of baseline dates that everything is initially due then use the update button for current accuracy on what is due for that week.
When the 28 day comes around it will require all inspections up to the 28 day to include the 7 and 14. All days on the spread sheet should match below that inspection.
- This inspections must be due on Wednesday of each week and show that date
- I have the formulas for A1:A5 right now to just add everything off the 14FEB date and adding 14/28/56/etc...
- I want to be able to hit an "UPDATE" button and have the dates change if < TODAY to update appropriately.
- I tried to add a basic button with the formula of =IF(A1 >TODAY, A1+ 7 - WEEKDAY(A1+7-4), 0) This formula does not work. So I was working towards a Active-X button to work for me.
- I was able to write to have the Active-X button throw a pop up window saying "date is before Today" with
If (CDate(A1) < TODAY) Then
MsgBox ("date is before Today")
- I have tried every way to Sunday to get the date to change to 14FEB18 if I have input already say 10JAN18. It will not change appropriately.
- I also do not want it to change the dates of the other cells B2:B5 if those dates have yet to pass. But I think I can put those parameters into the cell vise the VBA button?
A B
---------------------------------
1 | 14-Feb-18 7
---------------------------------
2 | 21-Feb-18 14
---------------------------------
3 | 14-Mar-18 28
---------------------------------
4 | 11-Apr-18 56
---------------------------------
5 | 6-Jun-18 112
---------------------------------
6 | 26-Sep-18 224
---------------------------------
Thank you for any help!
Bookmarks