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.
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.
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.
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
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?
Bookmarks