Count of how many times a macro is ran Today

SeliM

New Member
Joined
Aug 10, 2023
Messages
31
Office Version
  1. 365
Platform
  1. Windows
Good morning,
Could you advise if it possible to create a macro counter that records how many times a macro is ran on a given day pls.

I have tried to adjust the following to no avail:
"Range("A1").Value = Range("A1").Value + 1" which i found on the web.

Your advice would be much appreciated.

geoff
 
Glad you figured it out.
It is not necessary to utilize Select in order to interact with a cell, as it is inefficient. Instead, consider using With...End With, like this:
VBA Code:
Sub count()
'To count how many times the Data entry is ran
With Sheets("Sheet2")
    If .Range("B1") <> Date Then
    .Range("B1") = Date
    .Range("A1") = 0
    End If
    .Range("A1") = .Range("A1") + 1
End With

'data sheet (sheet1) selected
With Sheets("Sheet1")
    .Range("B2") = "1"
    .Range("B3") = "2"
    .Range("B4") = "3"
    .Range("B5") = "4"
End With

End Sub
 
Upvote 0

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Forum statistics

Threads
1,220,965
Messages
6,157,120
Members
451,399
Latest member
alchavar

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