Results 1 to 3 of 3

Auto refresh macro?

This is a discussion on Auto refresh macro? within the Excel Questions forums, part of the Question Forums category; Does anyone know if it is possible to have a macro that behaves the same as if you held down ...

  1. #1
    Board Regular cpg84's Avatar
    Join Date
    Jul 2007
    Location
    Brisbane, Australia
    Posts
    234

    Default Auto refresh macro?

    Does anyone know if it is possible to have a macro that behaves the same as if you held down the F9 button (refresh)?

    I have a clock formula (Weeks, Days, Hours, Minutes, Seconds in separate cells) and I want to press a button to get the screen to constantly refresh so you can see the time tick down.

    Also, if I manage to get this, will this affect other, unrelated spreadsheets I have open at the same time?

    Thanks

  2. #2
    Board Regular dave3009's Avatar
    Join Date
    Jun 2006
    Location
    Glasgow, Scotland
    Posts
    6,291

    Default Re: Auto refresh macro?

    You can turn off workbook calculation then use the ontime method to calculate a specific sheet. This will mean that the other sheets will need to be calculated manually or by way of an event.

    Code:
    Sub turnoff()
    'Turn Off calculation and start call ontime routine
    Application.Calculation = xlCalculationManual
    Call DoTimer
    End Sub
    
    Sub DoTimer()
    'Call the sheet calculation macro every one second
    Application.OnTime Now + TimeValue("00:00:01"), "Rep"
    
    End Sub
    
    Sub Rep()
    ' calculate the sheet and repeat the ontime process
    Sheet1.Calculate
    Call DoTimer
    End Sub
    Please state your version of Excel, I use Excel 2007 on Win 7.
    Back up all data before testing VBA codes, and please use [code] tags.
    davehouston.co.uk/

  3. #3
    Board Regular cpg84's Avatar
    Join Date
    Jul 2007
    Location
    Brisbane, Australia
    Posts
    234

    Default Re: Auto refresh macro?

    Cool, thanks.

    I will give it a try when I get home this arvo. Hopefully it will work.

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
  •  


DMCA.com