+ Reply to Thread
Results 1 to 6 of 6

hi i have formula it's working fine but i want to Automatically run macros at Specified.

Hybrid View

  1. #1
    Registered User
    Join Date
    10-01-2012
    Location
    kolkatta
    MS-Off Ver
    Excel 2003
    Posts
    7

    hi i have formula it's working fine but i want to Automatically run macros at Specified.

    hi
    i have formula it's working fine but i want to Automatically run macros at Specified. how to add in this formula specified time also.

    Dim TimeToRun
    
    Sub Run()
        Call Scheduler
    End Sub
    
    Sub Scheduler()
        TimeToRun = Now + TimeValue("00:00:01")
        Application.OnTime TimeToRun, "Copier"
    End Sub
    
    Sub Copier()
       
          Sheets("Sheet1").Range("a1").Copy Destination:=Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1)
    Sheets("Sheet2").Range("B" & Rows.Count).End(xlUp).Offset(1).Value = Now
    
      
        Call Scheduler
    End Sub
    
    Sub Resumer()
        On Error Resume Next
        Application.OnTime TimeToRun, "Copier", , False
    End Sub


    MODERATOR'S NOTE:

    Vikas, you managed to break two rules with one post! Oh my.

    I've moved your post to a thread of it's own as per rule #2
    I've added code tags to your post as per rule #3

    Please take a moment to read the Forum Rules (link is above in the menu bar). Thank you.
    Last edited by JBeaucaire; 10-07-2012 at 09:54 AM.

  2. #2
    Registered User
    Join Date
    08-02-2012
    Location
    every where
    MS-Off Ver
    Excel 2003
    Posts
    34

    Re: hi i have formula it's working fine but i want to Automatically run macros at Specifie

    I think you need something like this,
    Sub Run()
    Scheduler
    End Sub
    
    Sub Scheduler()
    Dim TimeToRun
    TimeToRun = Now + TimeValue("00:00:01")
    Application.OnTime TimeToRun, "Copier"
    End Sub
    
    Sub Copier()
    Sheets("Sheet1").Range("a1").Copy Destination:=Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1)
    Sheets("Sheet2").Range("B" & Rows.Count).End(xlUp).Offset(1).Value = Now
    Scheduler
    End Sub
    
    Sub Resumer()
    On Error Resume Next
    Application.OnTime TimeToRun, "Copier", , False
    End Sub

  3. #3
    Registered User
    Join Date
    10-01-2012
    Location
    kolkatta
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: hi i have formula it's working fine but i want to Automatically run macros at Specifie

    sir

    i want to run this macros Automatically at Specified time every day 10am.

  4. #4
    Valued Forum Contributor
    Join Date
    03-17-2012
    Location
    Warsaw, Poland
    MS-Off Ver
    2007/2010
    Posts
    555

    Re: hi i have formula it's working fine but i want to Automatically run macros at Specifie

    You have to put this code:

    Private Sub Workbook_Open()
    'Runs a macro at 10:00 AM
    
    Application.OnTime TimeValue("10:00:00"), "Name_of_Macro"
    
    End Sub
    In the thisworkbook vba section. For this to work, you have first to save the workbook somewhere, close and reopen it. It will only work if the workbook where this code resides stays open until the specified time (10am in ur case).

    It would be best if you try it out now (change the hour to the current time + 2min (dunno whats the local time where you live), so there won't be any problems when the macro has to be run for real.

    Cheers
    If you think that my answer was helpful, please click on the "Add to this user's Reputation" button.

  5. #5
    Registered User
    Join Date
    10-01-2012
    Location
    kolkatta
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: hi i have formula it's working fine but i want to Automatically run macros at Specifie

    thank's its working

  6. #6
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: hi i have formula it's working fine but i want to Automatically run macros at Specifie

    @ vikas2424

    Welcome to the forum.

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1