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

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

maabadi

Well-known Member
Joined
Oct 22, 2012
Messages
2,355
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,141,294
Messages
5,705,537
Members
421,399
Latest member
hjweiss00

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