Hello,
I am looking for a VBA code that can automatically refresh my excel sheet (cell A to D) every 1 mins, Friday to Sunday, from 8 am-4 pm.
I have a code here that only refreshes every 1 min, can't figure out how to set the day and time to it. Please help. Thanks
Sub refresh1()
'
' refresh1 Macro
'
Range("D12,A:A,B:B,C:C").Select
Range("Book1[[#Headers],[urgency]]").Activate
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 8
Range("D12,A:A,B:B,C:C"). _
Select
Range("Book1[[#Headers],[BookID]]").Activate
With ActiveWorkbook.Connections("Query - Book1").OLEDBConnection
.BackgroundQuery = False
.CommandType = xlCmdTableCollection
.Connection = _
"OLEDB;Provider=Microsoft.Mashup.OleDb.1;Data Source=$Workbook$;Location=Book1;Extended Properties="""""
.RefreshOnFileOpen = True
.RefreshPeriod = 5
.SavePassword = False
.SourceConnectionFile = ""
.SourceDataFile = ""
.ServerCredentialsMethod = xlCredentialsMethodIntegrated
.AlwaysUseConnectionFile = False
End With
With ActiveWorkbook.Connections("Query - Book1")
.Name = "Query - Book1"
.Description = "Connection to the 'Book1' query in the workbook."
End With
End Sub
I am looking for a VBA code that can automatically refresh my excel sheet (cell A to D) every 1 mins, Friday to Sunday, from 8 am-4 pm.
I have a code here that only refreshes every 1 min, can't figure out how to set the day and time to it. Please help. Thanks
Sub refresh1()
'
' refresh1 Macro
'
Range("D12,A:A,B:B,C:C").Select
Range("Book1[[#Headers],[urgency]]").Activate
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 8
Range("D12,A:A,B:B,C:C"). _
Select
Range("Book1[[#Headers],[BookID]]").Activate
With ActiveWorkbook.Connections("Query - Book1").OLEDBConnection
.BackgroundQuery = False
.CommandType = xlCmdTableCollection
.Connection = _
"OLEDB;Provider=Microsoft.Mashup.OleDb.1;Data Source=$Workbook$;Location=Book1;Extended Properties="""""
.RefreshOnFileOpen = True
.RefreshPeriod = 5
.SavePassword = False
.SourceConnectionFile = ""
.SourceDataFile = ""
.ServerCredentialsMethod = xlCredentialsMethodIntegrated
.AlwaysUseConnectionFile = False
End With
With ActiveWorkbook.Connections("Query - Book1")
.Name = "Query - Book1"
.Description = "Connection to the 'Book1' query in the workbook."
End With
End Sub