Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: How do I automatically run a macro every... Thanks DK!

  1. #1
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi everyone!

    I would appreciate it very much if someone could share some code which will start a two minute cycle when a workbook is opened.

    This workbook will check a data source as soon as it is opened. I would like to make it able to repeat this task every two minutes.

    Thanks!

    [ This Message was edited by: TsTom on 2002-03-24 11:22 ]

  2. #2
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Sydney, Australia
    Posts
    2,940
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi TS Tom - how's this?

    Code:
    Dim lngTimesMacroRan As Long
    
    Sub CheckDataSource()
    'Put your macro for checking the data source in here
    'E.g.
    Sheets("Sheet1").Cells(1, 1).Value = "The macro CheckDataSource has ran " & lngTimesMacroRan + 1 & " times."
    lngTimesMacroRan = lngTimesMacroRan + 1
    Application.OnTime Now + TimeValue("00:02:00"), "CheckDataSource"
    End Sub
    HTH,
    D

  3. #3
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks DK
    I will try it out.
    Tom

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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