• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How Do I set up a data connection to only update data once per day?

Tome9499

New Member
Greetings,


I have a workbook that I modify daily. After I modify the workbook, my team reviews the results. The workbook (Survey Results) has a data connection that draws in data from an external source (Additional Data)on our intranet. Since Additional Data is only updated once each day at 2:00 AM, there is no need for the data connection to pull that data into Survey Results every time the workbook is opened.


Is there a way to streamline the process so that the Survey Results workbook only draws new data the first time it is opened each day while keeping the data update automatic? It seems as though there should be a way to accomplish this using VBA, but I do not know the code.


Thanks in advance,


Tom
 
You could time stamp a cell showing the date and time of last data pull. Then do some logical check like this (this would be in the ThisWorkbook module):

Code:
Private Sub Workbook_Open()

'Should pull at 2 am

DataPull = Date + TimeValue("2:00:00")

TimeStamp = Range("A2")


If TimeStamp < DataPull And Now > DataPull Then

'Update data

'Your code goes here


Range("A2") = Now

End If


End Sub
 
Back
Top