How to run VBA event only once in a day?

Mdarshadali2609

New Member
Joined
May 9, 2021
Messages
1
Office Version
  1. 365
  2. 2016
  3. 2013
Platform
  1. Windows
I recorded a script to a macro file and called that specific macro using a VBA project (personal.xlsb). Every time any Excel is open (Workbook_open).

But now I only want to restrict that call to once a day. For example if the individual macro calls that specific macro once a day, then the event is postponed to the next day and the macro is not called upon opening any Excel file.

Please tell me how I can ban my event performing only once a day, and the next event should take place the next day.

Thank you
Code:
Sub run()


Application.run "'C:\Users\850051636\OneDrive - Genpact\Desktop\Working\Project 5 WIP Stock Transfer\Working QPA_Stock Transfer_Draft_v1.0.xlsm'!Module1.test"

End Sub
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

maabadi

Well-known Member
Joined
Oct 22, 2012
Messages
2,681
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Welcome to MrExcel Message Board.
Change Cell A1 if you have data on it.
You Can Try this:
VBA Code:
Sub run()
If Range("A1").Value = Date then exit sub 
Application.run "'C:\Users\850051636\OneDrive - Genpact\Desktop\Working\Project 5 WIP Stock Transfer\Working QPA_Stock Transfer_Draft_v1.0.xlsm'!Module1.test"
Range("A1").Value = date
End Sub
Also you can use workbook open event I think.
 

Forum statistics

Threads
1,175,980
Messages
5,900,690
Members
434,843
Latest member
Excel_is_Hard

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
Top