+ Reply to Thread
Results 1 to 6 of 6

Initiate Macro

  1. #1
    Registered User
    Join Date
    08-20-2009
    Location
    Pennslyvania
    MS-Off Ver
    Excel 2007
    Posts
    10

    Initiate Macro

    I created a macro that I wanted to run based on time. I'd like to use an IF statement combined with on of the time functions that would run this macro say every 20 minutes after the hour.
    a) I haven't figured how to get a macro to run other than manually starting it.
    b) i havent' figured out how to use the NOW() function that updates by itself

    Any ideas?

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Initiate Macro

    You need to use the OnTime method, use the Forum search & you will find many examples
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    08-20-2009
    Location
    Pennslyvania
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Initiate Macro

    Thank you very much. I tried it out and used

    Please Login or Register  to view this content.
    to initiate the macro at a certain time. That worked very well. How would I be able to set it to initiate at a specific time on a specific date?
    Last edited by royUK; 10-03-2009 at 04:08 AM.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Initiate Macro

    Please Login or Register  to view this content.
    Please edit your post to add code tags.
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Registered User
    Join Date
    08-20-2009
    Location
    Pennslyvania
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Initiate Macro

    I have another challenge that I hope you can help me overcome. Using the above code, if I set it to run @ a certain time and date and I have another excel spreadsheet at the time. If errors out because it can't find the right spreadsheet.
    For Example In The Code I'm Using:
    Set RangeToPoke = Worksheets("Raw Data").Range("B2")
    Can I specify more than that so it knows to run on the specific workbook? It runs fine in the background if I have any other program open, but if I have another excel spreadsheet it errors. Help Please!

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Initiate Macro

    You need to post the rest of the code.

    Please edit your post to add code tags.

+ 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