Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default code for program run once everyday

What is the code if I want it runs only once per day?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default code for program run once everyday

If you mean set a macro to run at a scheduled time then see

http://www.cpearson.com/excel/ontime.htm

otherwise if you mean only allow a macro to be run only once per day then
you could have a hidden sheet (Sheet1 in my example) with a date in cell A1.
Then you could code your macro like this:

Sub RunIt()
If Sheets("Sheet1").Range("A1").Value = Date Then
MsgBox "Macro has been run already today.", vbExclamation
Else
Sheets("Sheet1").Range("A1").Value = Date
'rest of code here
End If
End Sub

This checks the date on the hidden sheet and if it is not the current date
it sets it to today and then runs rest of code. If the date on the sheet is
already today then it gives a message saying the macro has already been run.

Hope this helps
Rowan

"Angus" wrote:

What is the code if I want it runs only once per day?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default code for program run once everyday

Application.OnTime "08:00","MyProc"
read HELP for more

"Angus" wrote:

What is the code if I want it runs only once per day?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
automatically run a macro everyday Kam Excel Discussion (Misc queries) 6 December 12th 09 06:04 PM
Auditing excel for everyday tasks test[_3_] Excel Worksheet Functions 6 March 2nd 09 12:30 PM
Add code to a excel's form created by program (Vb .Net) Pablo via OfficeKB.com New Users to Excel 0 June 29th 05 01:34 PM
[HELP] closing a program with VBA code Andr? Palmela Excel Programming 2 October 21st 04 05:47 PM
Searching for VB Code to Link to Program PM_24_7 Excel Programming 0 November 18th 03 05:20 PM


All times are GMT +1. The time now is 05:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"