Jenniphurr
New Member
- Joined
- Mar 9, 2018
- Messages
- 4
I am needing to track inventory age in column H. So far I have a button that I press first thing in the morning to run this macro. It add +1 to all the numbers that are in column H. My goal is to have my macro do this for me when I open the workbook. The thing is I only want it to perform this macro if the date has changed. Honestly I really just want to not push my age button, plus it takes one more step out of my inventory tracking.
Here is the macro I am working with at the moment. I am even trying to add in some vba code on top of my existing macro.
First off here is my age macro (this is what I link to a button to press each day)
Sub pasteifage()
Dim r As Range, cell As Range
Set r = Range("h:h")
For Each cell In r
If IsNumeric(cell.Value) Then
If cell.Value > 0 Then
cell.Value = cell.Value + 1
End If
Else
MsgBox "Cell " & cell.Address(0, 0) & " does not have a number"
Exit Sub
End If
Next
End Sub
I found this macro and tried to insert it into the above, but sadly no luck getting it to work.
If Sheetx.Range("rLastRun").Value2 < Date Then
<your macro>
Sheetx.Range("rLastRun").Value2 = Now()
End If
Here is the macro I am working with at the moment. I am even trying to add in some vba code on top of my existing macro.
First off here is my age macro (this is what I link to a button to press each day)
Sub pasteifage()
Dim r As Range, cell As Range
Set r = Range("h:h")
For Each cell In r
If IsNumeric(cell.Value) Then
If cell.Value > 0 Then
cell.Value = cell.Value + 1
End If
Else
MsgBox "Cell " & cell.Address(0, 0) & " does not have a number"
Exit Sub
End If
Next
End Sub
I found this macro and tried to insert it into the above, but sadly no luck getting it to work.
If Sheetx.Range("rLastRun").Value2 < Date Then
<your macro>
Sheetx.Range("rLastRun").Value2 = Now()
End If