PDA

View Full Version : Solved: Refresh data upon open



john3j
04-14-2009, 12:28 PM
Hello,

I am trying to figure out how to get this data that i have imported from access to refesh when the file is opened. Can anyone let me know how to refresh this data when the workbook is opened, then run a sub called SortAndColor. If possible, it would be nice for it to not prompt for automatic refresh. If someone could help me this would be great.

I was using the following but it will not process past the first line (Selection.QueryTable.Refresh BackgroundQuery:=False).

Private Sub Workbook_open()
Selection.QueryTable.Refresh BackgroundQuery:=False
Call SortAndColor
End Sub

Thanks!

mdmackillop
04-14-2009, 12:44 PM
Selection is not set on opening. Define your range, something like

Sheets(2).Range("A1:G500").QueryTable.Refresh BackgroundQuery:=False