Refreshing working for set intervals and time

HettyA

New Member
Joined
Aug 20, 2020
Messages
5
Office Version
  1. 2007
Platform
  1. Windows
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
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top