One of Multiple VBA Macros run dependant on DDD format cell

Read_This

New Member
Joined
Aug 13, 2014
Messages
37
I have two working VBA Macros, each running 58 Data Connections currently as:

"iTrackerDataRefresh5Fri"
and
"iTrackerDataRefresh6Sat"

(below is a sample of the data connections)

Left as-is it runs 408 data connections which takes time to complete.

So, I would like to get smart and 'just' use the macro I need - dependant on the day Formatted "DDD" in Cell B1

I have attempted an 'If' VBA macro to choose a macro based on the "DDD" below however, it doesn't work.

Your thoughts and suggestions would be appreciated

-------------------------------------------------------
Sub iTrackerDataRefreshChoice()
'
Application.ScreenUpdating = False
If Range("B1").Value = "Fri" Then
Application.Run "iTrackerDataRefresh5Fri"
End If
If Range("B1").Value = "Sat" Then
Application.Run "iTrackerDataRefresh6Sat"
End If
Application.ScreenUpdating = True
End Sub
-------------------------------------------------------

Sub iTrackerDataRefresh5Fri()
'
Application.ScreenUpdating = False
ActiveWorkbook.Connections("Connection237").Refresh
ActiveWorkbook.Connections("Connection238").Refresh
ActiveWorkbook.Connections("Connection239").Refresh
ActiveWorkbook.Connections("Connection240").Refresh
ActiveWorkbook.Connections("Connection241").Refresh
ActiveWorkbook.Connections("Connection242").Refresh
ActiveWorkbook.Connections("Connection243").Refresh
ActiveWorkbook.Connections("Connection244").Refresh
ActiveWorkbook.Connections("Connection245").Refresh
ActiveWorkbook.Connections("Connection246").Refresh
ActiveWorkbook.Connections("Connection247").Refresh
Application.ScreenUpdating = True
End Sub
-------------------------------------------------------

Sub iTrackerDataRefresh6Sat()
'
Application.ScreenUpdating = False
ActiveWorkbook.Connections("Connection296").Refresh
ActiveWorkbook.Connections("Connection297").Refresh
ActiveWorkbook.Connections("Connection298").Refresh
ActiveWorkbook.Connections("Connection299").Refresh
ActiveWorkbook.Connections("Connection300").Refresh
ActiveWorkbook.Connections("Connection301").Refresh
ActiveWorkbook.Connections("Connection302").Refresh
ActiveWorkbook.Connections("Connection303").Refresh
ActiveWorkbook.Connections("Connection304").Refresh
ActiveWorkbook.Connections("Connection305").Refresh
ActiveWorkbook.Connections("Connection306").Refresh
Application.ScreenUpdating = True
End Sub
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
All sorted with self help thank you - very simple [now I know] I removed the numbers from the VBA naming.
 
Upvote 0

Forum statistics

Threads
1,215,819
Messages
6,127,045
Members
449,356
Latest member
tstapleton67

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