hi
I would like to run a macro at every day 4.15 am
I have inserted following code to workbook
its not working..can anyone help me please..![]()
Private Sub Workbook_Open() Application.OnTime TimeValue("04:15:00"), "Saveas()" End Sub
hi
I would like to run a macro at every day 4.15 am
I have inserted following code to workbook
its not working..can anyone help me please..![]()
Private Sub Workbook_Open() Application.OnTime TimeValue("04:15:00"), "Saveas()" End Sub
Last edited by ammei; 06-15-2013 at 06:48 AM.
Remove the () from Saveas()
And if it isn't already, try placing the 'Saveas' macro in its own module, and that 'Saveas' is a Public Sub, not Private.
It works fine for me when I do those things... but I am on a Mac - so not sure if that translates to a PC.
- Moo
Hi..
Try changing this..
to this..![]()
Application.OnTime TimeValue("04:15:00"), "Saveas()"
I Agree with Moo the Dog.. remove the ()![]()
Application.OnTime TimeValue("04:15:00"), "Saveas", Schedule:=True
Last edited by apo; 06-15-2013 at 07:35 AM. Reason: typo
i have already remove the ()
and did as u said..still not working..:/
Hi..
What exactly not working?
The Call to the Save Routine OR
the Save routine itself?
Try replacing your Saveas Routine with something simple like:
If you see the message box.. then you can narrow down that your issue is with the actual save routine and not the timer..![]()
Sub Saveas() MsgBox "Hi" End Sub
the problem is with the Call to the Save routine..
Hi..
I am attaching a simple example of calling a MsgBox at a specific time..
Just set the time to trigger the MsgBox in this line:
Press the "Start Timer" button to initiate the process....![]()
dTime = TimeValue("22:23:00")
Hopefully that will get you where you need to be..
ok..thanks..![]()
Values.xlsm
i have attached a sheet..can u show me on this how to automatically save the contents of cell values in a folder when it reach 4.15 AM
Hi.. Yeap.. no worries.. its late here.. will have a stab at it tomorrow..
one thing.. when you say.. "contents of cell values".. what do you mean?
Be specific... do you mean (using you sample sheet as an example).. you want to save the contents of B12 when the timer reaches 4.15 am?
And if so.. you could copy that value to a new Workbook and then save it to the folder you want.. ?
Please clarify...
i want to automatically save the contents of B4 to B12 to another worksheet and save it in a folder when is 4.15 AM.
k. clear.. will do it tomorrow.. (unless someone else cracks it for you before..).
You can't save a Worksheet to a folder.. yes.. you can save it to a WorkBook and save it in a folder.. the point i am making is that it is best to be precise and get your terminology correct so you will get the best help available..i want to automatically save the contents of B4 to B12 to another worksheet and save it in a folder when is 4.15 AM.
see you tomorrow...![]()
Hi..
Put this in a Module..
And add this to your Sheet code to call it at 4:15 AM..![]()
Sub Saveas() Dim ShNames As Variant ShNames = Array("Sheet1", "Sheet2", "Sheet3") Application.ScreenUpdating = False Application.DisplayAlerts = False Sheets("Sheet1").Range("B4:B12").Copy Destination:=Sheets("Sheet2").Range("B4") Set NewWkbk = Workbooks.Add ThisWorkbook.Sheets("Sheet2").Copy Before:=NewWkbk.Sheets(1) NewWkbk.Sheets(1).Name = "Data" Worksheets(ShNames).Delete NewWkbk.Saveas ThisWorkbook.Path & "\" & Format(Now, "long date") NewWkbk.Close Application.ScreenUpdating = True Application.DisplayAlerts = True End Sub
![]()
Private Sub Worksheet_Activate() Application.OnTime TimeValue("04:15:00"), "Saveas", Schedule:=True End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks