I think the title sums this one up for the most part. I have a cell with a value in it, I just want to automatically subtract 150 from that value each month when the month changes.
What would be the best way to approach that?
I think the title sums this one up for the most part. I have a cell with a value in it, I just want to automatically subtract 150 from that value each month when the month changes.
What would be the best way to approach that?
We still need a workbook (see yellow banner for instructions on how to attach) as we have no idea how your data is organised.
If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.
Workbook_Open event is used. When workbook s opened if month is different from the month of E2 amount is deducted. E2 will get Today() date.
Formula:Please Login or Register to view this content.
Developer-->> visual Basic-->> VB window opens
select Workbook--> Paste the Code-->> Save the file as .xlsm
Pl note
Array formula should be confirmed with Ctrl+Shift+Enter keys together.
If answere is satisfactory press * to add reputation.
Amended VBA re Range references
Please Login or Register to view this content.
Thanks John topley for correction.
Pl see file for corrected code.
example included.... I want to automatically subtract number 2 from number 1 every month.
I thought this could be done with a formula though, or can it only be done with VBA?
It can be done with a formula:
=25400-DATEDIF(DATE(2023,3,1),TODAY(),"m")*B2
This will subtract the first 103.5 on 1st April...another one on 1st May, etc.
Test it using
=25400-DATEDIF(DATE(2023,3,1),DATE(2023,4,1),"m")*B2
where the bit in red is a future date (Y,m,d)
Glenn
None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.
Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh
Much appreciated.
All the formulas I've been shown in the last week or so have really helped make my budget spreadsheet much much easier to manage.
There are currently 3 users browsing this thread. (0 members and 3 guests)
Bookmarks