Home » excel » excel – VBA macro beginner – How can I make the following code stop and start between tasks?

excel – VBA macro beginner – How can I make the following code stop and start between tasks?

Posted by: admin May 14, 2020 Leave a comment

Questions:

I am a complete beginner with no formal education in coding. Given below is a VBA code that I wrote. I run this in a Macro enabled excel sheet. After each action, the code waits 10 mins before moving onto the next action. However, in those 10 minutes, I cannot make any manual changes to the excel sheet as the macro is constantly in “wait mode”. Is there any way I can get the macro to stop running and then start again 10 minutes later? That way I can make changes to the excel sheet during the interim period.

Also, any other suggestions to optimise the code are welcome as long as the output remains the same. Thanks a lot.

Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B5").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B8").Select
ActiveSheet.Paste
Range("A5").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B11").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B14").Select
ActiveSheet.Paste
Range("A11").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B17").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B20").Select
ActiveSheet.Paste
Range("A17").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B23").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B26").Select
ActiveSheet.Paste
Range("A23").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B29").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B32").Select
ActiveSheet.Paste
Range("A29").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B35").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B38").Select
ActiveSheet.Paste
Range("A35").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B41").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B44").Select
ActiveSheet.Paste
Range("A41").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B47").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B50").Select
ActiveSheet.Paste
Range("A47").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B53").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B56").Select
ActiveSheet.Paste
Range("A53").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B59").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B62").Select
ActiveSheet.Paste
Range("A59").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B65").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B68").Select
ActiveSheet.Paste
Range("A65").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B71").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B74").Select
ActiveSheet.Paste
Range("A71").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B77").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B80").Select
ActiveSheet.Paste
Range("A77").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B83").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B86").Select
ActiveSheet.Paste
Range("A83").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B89").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B92").Select
ActiveSheet.Paste
Range("A89").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B95").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B98").Select
ActiveSheet.Paste
Range("A95").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B101").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B104").Select
ActiveSheet.Paste
Range("A101").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B107").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B110").Select
ActiveSheet.Paste
Range("A107").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B113").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B116").Select
ActiveSheet.Paste
Range("A113").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B119").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B122").Select
ActiveSheet.Paste
Range("A119").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B125").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B128").Select
ActiveSheet.Paste
Range("A125").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B131").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B134").Select
ActiveSheet.Paste
Range("A131").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B137").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B140").Select
ActiveSheet.Paste
Range("A137").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B143").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B146").Select
ActiveSheet.Paste
Range("A143").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B149").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B152").Select
ActiveSheet.Paste
Range("A149").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B155").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B158").Select
ActiveSheet.Paste
Range("A155").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B161").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B164").Select
ActiveSheet.Paste
Range("A161").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B167").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B170").Select
ActiveSheet.Paste
Range("A167").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B173").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B176").Select
ActiveSheet.Paste
Range("A173").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B179").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B182").Select
ActiveSheet.Paste
Range("A179").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B185").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B188").Select
ActiveSheet.Paste
Range("A185").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B191").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B194").Select
ActiveSheet.Paste
Range("A191").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B197").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B200").Select
ActiveSheet.Paste
Range("A197").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B203").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B206").Select
ActiveSheet.Paste
Range("A203").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B209").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B212").Select
ActiveSheet.Paste
Range("A209").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B215").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B218").Select
ActiveSheet.Paste
Range("A215").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"
Application.Wait DateAdd("s", 580, Now)
Sheets("NSE Data").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Application.Wait DateAdd("s", 15, Now)
Range("B48:V50").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B221").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("NSE Data").Select
Range("B1").Select
Selection.Copy
Sheets("2nd Nov").Select
Range("B224").Select
ActiveSheet.Paste
Range("A221").Select
ActiveCell.Value = Time
ActiveCell.NumberFormat = "h:mm AM/PM"`
How to&Answers:

You could break your code into more modular code where each sub does one thing and use that with Application.OnTime to execute each sub at time intervals

Option Explicit Public Sub test() Dim t As Date t = Time Application.OnTime t + TimeSerial(0, 0, 10), "a" Application.OnTime t + TimeSerial(0, 0, 20), "b" End Sub Public Sub a() Debug.Print "A" End Sub Public Sub b() Debug.Print "B" End Sub 

Executing in a loop moving by 5 rows:

Option Explicit Public Sub test() Dim t As Date, i As Long For i = 1 To 5 t = Time Application.OnTime t + TimeSerial(0, 0, i * 10), "'a """ & i * 5 & """'" Next End Sub Public Sub a(ByVal rowNumber As Long) Debug.Print Cells(rowNumber, 1).Address End Sub