logo elektroda
logo elektroda
X
logo elektroda

Automating Excel Sheet Refresh Every Minute Without Pressing F9

Lukasz4 26874 11
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 720584
    Lukasz4
    Level 2  
    Hello everyone.
    I am struggling with such a problem:
    I have to update the time in excel every 1 minute (I use 'NOW')
    How to introduce loops so that every 1 minute (or more) it refreshes the sheet,
    (without pressing F9)?

    Many thanks in advance for your answers.
  • ADVERTISEMENT
  • #2 720851
    kotlet
    Level 20  
    I don't know what you mean, maybe it's clearer.
  • #3 721128
    kosmita
    VIP Meritorious for electroda.pl
    and do this: turn on the macro recorder, press F9, stop recording macros, edit the macro, see the visual basica help and make a suitable loop ... it's so quickly figured out, I think there are better ways ... offica, question: what kind of offica do you have ??
  • ADVERTISEMENT
  • #4 723480
    jurek11
    Level 12  
    you need to turn on automatic refresh
  • ADVERTISEMENT
  • #5 723917
    kosmita
    VIP Meritorious for electroda.pl
    jurek11 wrote:
    you need to turn on automatic refresh

    but it refreshes after any change of the document and not every specified time interval so this advice is rather nonsense
  • #6 724018
    bobo
    Level 29  
    Refreshing in Excel affects the entire workbook, not a single sheet, and this is where unexpected surprises can arise. The second thing, all events work after some "move", not automatically (except for example Autosave). After all, you can use VBA to write a procedure that measures the duration of the opening of a given workbook (unfortunately, to update the result, an event must also be performed). And finally, why "bother" the clock in the sheet, since the time is displayed on the bar on a regular basis.
    Greetings
  • ADVERTISEMENT
  • #7 724132
    kosmita
    VIP Meritorious for electroda.pl
    how do you have 5 workbooks related to each other ?? in one you will add something there, but it does not entail changes in another .. example two: on the basis of the hour you calculate the value of the service and you want to have the current price all the time, what should I press F9 every hour? I think it's better to do what ?? or run some excel functions, if any
  • #8 724162
    bobo
    Level 29  
    Re, alien, since as you write yourself that you have many files there related to each other (it goes without saying that functions work in the background), changes in one cause updates in others (they do not have to be active in a given session, other workbooks sic !, such a trick with updating data can be done with the help of VBA), except that something is related and does not interact? Ad. 2, after all, an executing loop is a consequence of an event, it must be triggered by something, it will not do itself.
    Greetings

    Ps. And one more note, if you run a loop, for example at the start of a sheet, it works for the entire time you open it. It is not difficult to imagine what the release of the worksheet will be like, as long as the session allows changes to be made. Another story is where to locate the scope of the loops, globally or locally.
  • #9 724503
    elektryk
    Level 42  
    I will quote something from help:
    Refreshing data at specified intervals
    1. If the External Data Range Properties dialog box is not displayed, click a cell in the external data range, and then click the Data Range Properties button on the External Data toolbar.

    2. Check the Refresh every box, and then enter the number of minutes between refreshes.
    maybe it will tell you something.
  • #10 726612
    Lukasz4
    Level 2  
    Thanks to everyone for the hints but I still don't know how to solve it.

    Maybe I'll tell you what I'm up to:
    wants to monitor certain events
    in the lines I have the time and next to the event that is to occur
    this is a lot (about 350) and I want to highlight the ones that now have a place

    e.g.
    9:01:24 - switching on the electricity
    9:01:46 - increasing the current by ...
    9:02:02 - putting on something

    By doing a macro and calculating the sheet (only F9 in macro)
    then turning on this macro refreshes me once
    doing loops ('goto' in this macro) it refreshes all the time, but the program is looping (loading the system) and I can't do anything else.

    I do not have external data in the sheet, so the property function in external data is not highlighted (you cannot change the interval)

    ???????????
    May enter fictitious external data, e.g. a constant and then update the sheet every some interval ...................... ?????????????
  • #11 726641
    kursant
    Level 18  
    Where do you get this data from?
    For example, wanting to receive current data values from FIX in Excel, and not only when something is done there, e.g. pressing Enter, I entered a link to the clock in FIX and then Excel refreshed all data with the clock frequency, i.e. every 1 second.
  • #12 727177
    bobo
    Level 29  
    The idea of a student, a student, sensational. That's it, control from an external device whenever possible. Below I present a short code, the only purpose of which is to flash the cell every 1 second. By combining wisely, you can adapt it to your own needs.

    Declare in Module

    Private change As Boolean
    Sub UpdateClock ()

    Dim range As Range

    Set range = Range ("A1")

    If change Then
    range.Interior.ColorIndex = xlNone
    range.Font.Color = vbBlack
    Else
    range.Interior.Color = vbBlack
    range.Font.Color = vbWhite
    End If

    change = Not change

    NextTick = Now + TimeValue ("00:00:01")
    Application.OnTime NextTick, "UpdateClock"

    End Sub
    Code by Piotr Chlabicz (pl.comp.lang.vbasic)
    Regards

Topic summary

The discussion revolves around automating the refresh of an Excel sheet every minute using the NOW function without manually pressing F9. Users suggest various methods, including using the macro recorder to create a loop in VBA, enabling automatic refresh settings, and utilizing the Application.OnTime method to schedule updates. However, challenges arise as Excel's refresh typically occurs after document changes, not at specified intervals. The author seeks a solution to monitor events in real-time, highlighting specific occurrences based on time stamps. A sample VBA code is provided to flash a cell every second, which can be adapted for the author's needs.
Summary generated by the language model.
ADVERTISEMENT