Get stock data from Exchange at specific intervals automatically

How to get stock data from an Exchange at specific intervals automatically using VBA.
Here’s the complete VBA code:

Option Explicit

Dim myTimer As Date

Sub GetMyData()

Dim lastrow As Long, nextblankrow As Long

myTimer = Now + TimeValue(“00:01:00”)


lastrow = Sheets(“Sheet1”).Range(“G” & Rows.count).End(xlUp).Row

nextblankrow = lastrow + 1

Range(“G” & nextblankrow).PasteSpecial xlPasteValues


Application.OnTime myTimer, “GetMyData”

End Sub

Sub StopGettingData()

Application.OnTime myTimer, “GetMyData”, , False

MsgBox “Data Transfer Stopped!”

End Sub

Watch the video below: