Loooking for assistance to set a macro up to run daily

Jenniphurr

New Member
Joined
Mar 9, 2018
Messages
4
I am needing some assistance on this concern. I have beensearching and trying to piece together a macro that does what seems to be asimple idea. But the more I dive into this the more involved it seems tobecome.
I use excel to track vehicle inventory and what I am working on rightnow is tracking how old something is in our inventory. I manually input thevehicle data into my workbook. One of those columns I enter in "1" for thevehicle age. From this point on I need this “age” number to increase by 1 eachday that goes by. Right now I have set up macro to a command button that I click each dayto increase the age.
Here is the macro I have set up for the command button:
Sub age()
Dim r As Range,cell As Range
Set r =Range("e10:e1000000")
For Each cell In r
IfIsNumeric(cell.Value) Then
Ifcell.Value > 0 Then
cell.Value = cell.Value + 1
End If
Else
MsgBox"Cell " & cell.Address(0, 0) & " does not have anumber"
Exit Sub
End If
Next
End Sub


This is the macro that I need to run every day. Below I have a few hurdles I am trying to overcome to make this more seamless and easier.
-I need this macro to run each day and account for days I amnot opening the workbook, for example holidays or days off, so if I am away for2 days, when I return and open the workbook it will account for the amount ofdays that the workbook wasn't opened.
-when I first open the workbook for the day, I need themacro to run and if conditions are met update the age by +1
-I close and open my workbook throughout the day so I needthe auto-run to not run the macro if it has ran for that day.
-want to keep this in within excel – I have seen mention ofusing windows scheduler but I do not want to go that route.

I have also tried using "Application.OnTime" but I am only able to get this to run once and it fails and breaks when I close the workbook. This holds true even if I have reopen it before the time I set.

Any help I would be most grateful for, thanks!
(also I am new here so If there is a better way of explaining I will make those changes to reflect)
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
could you not, instead of entering a "1" on the start date, enter the start date. Then you could have a formula =Today() - [StartDate cell] to give you the number of days between now and when it started?
 
Upvote 0
I would need it to compile the entire of the sheet for column "E". So I would have to input the formula every time I enter data and not really wanting to do that. I'll just keep hitting the button if that is the case.

The sheet I use this on, I actively am adding and moving data to a completed/archive sheet. I have a few macros set up to cut, copy, paste and delete rows from this sheet. This act causes formulas to break so I try to stay away from them.

I do appreciate your input though! Thank you~
 
Upvote 0

Forum statistics

Threads
1,215,779
Messages
6,126,848
Members
449,343
Latest member
DEWS2031

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top