Results 1 to 4 of 4

Thread: Need macro in excel to refresh the screen

  1. #1
    Join Date
    May 2008
    Posts
    24

    Need macro in excel to refresh the screen

    Hi,

    I have an excel worksheet bound to a database. Now on a particular phase or time I want macro in excel to refresh the data when I open the excel file.
    If anyone of you doing this please let me know.

    Thanks in advance.

  2. #2
    Join Date
    May 2008
    Posts
    42

    Re: Need macro in excel to refresh the screen

    What do you have in back end? I mean where is your database?
    I consider its access. You need to first have a copy of your data. Now try working on it.
    If you have connect Excel with Access then you just need a command to refresh the screen & fetch the values from the access database.
    I have already written a macro that updates the database But the only problem with me is that I need to instruct the macro to run each time.
    I am looking for a screen refresh that will automatically refresh the excel workbook at a given interval of time.
    Please help me guys.

  3. #3
    Join Date
    May 2008
    Posts
    29

    Re: Need macro in excel to refresh the screen

    There is no need to write any code for this. Excel pivot tables have an option to auto refresh when the spreadsheet opens. All you need is to check the box and you are done.
    But if u need MACROS try this what I found:
    Code:
    ' General Declarations
    Public RunWhen As Double
    Public Const cRunIntervalSeconds = 60 ' seconds between updates
    Public Const cRunWhat = "UpdateLinks" ' name of procedure to run
    Public Toggle As Double
    
    ' Ensure Timer Starts when Workbook is opened
    '
    Private Sub Auto_Open()
    Call StartTimer
    End Sub
    
    Sub StartTimer()
    
    RunWhen = Now + TimeSerial(0, 0, cRunIntervalQuick)
    Application.OnTime EarliestTime:=RunWhen, Procedure:=cRunWhat, Schedule:=True
    End Sub
    
    Sub UpdateLinks()
    '
    ' Update data from external files
    '
    Application.ScreenUpdating = False
    ActiveWorkbook.UpdateLink Name:= _
    "\\SPREADSHEET PATH AND NAME.xls", Type:= xlExcelLinks
    Application.ScreenUpdating = True
    End Sub

  4. #4
    Join Date
    May 2008
    Posts
    32

    Re: Need macro in excel to refresh the screen

    IF its external data
    1. If "External Data" tool bar is not visible in your menu bar,
    select it by View - Toolbar
    2. External data - select "Data Range Properties" icon
    3. When the dialog box opens, under "Refresh Control" select refresh frequency.

    This is quite simple its solves the purpose why you want a Macro?

Similar Threads

  1. Excel 2003 Macro doesn't work in Excel 2007
    By jjaw in forum Windows Software
    Replies: 3
    Last Post: 03-01-2014, 02:28 PM
  2. How to use Excel Macro
    By aSITA in forum Windows Software
    Replies: 5
    Last Post: 12-02-2011, 09:34 PM
  3. What is a Macro that is used in MS Excel?
    By Common in forum Windows Software
    Replies: 5
    Last Post: 19-03-2010, 02:08 AM
  4. Macro to Add Columns in Excel
    By geokilla in forum Windows Software
    Replies: 3
    Last Post: 15-10-2009, 01:40 PM
  5. How to create a macro in Excel
    By Bhadrak in forum Windows Software
    Replies: 3
    Last Post: 06-05-2009, 03:13 PM

Posting Permissions

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