Track changes from external data from web
Hi,
i'm really new to VBA, now i doing a stuff for myself which can track changes and move the data and store in another cells.
basically i look through the tutorial provided in the home page, and it helps me a lot, but i want to enhance it more.
- The excel sheet will auto refresh every 30 minutes
- after refresh, the value in cells changed (numbers) or maintain, then the VBA will copy the value and store it in a particular cells.
- time stamp when refresh and time stamp after copy the value to another cells.
i currently have own one, but not really smart, because sometimes internet causin slow then the data still copy. so it will causing the timer of copy already reach, but the auto refresh is not yet done.
hope the information i provided enough. Thank you very much.
'Variable to Store Timer
Dim timeStore1
Dim timeStore2
Dim timeStore3
Dim timeStore4
'Start The Program
Sub startProgram()
Range("G3:G28").ClearContents
Range("K3:K28").ClearContents
Range("G31:G56").ClearContents
Range("K31:K56").ClearContents
Range("G70:G93").ClearContents
Range("K70:K93").ClearContents
Range("G257:G280").ClearContents
Range("K257:K280").ClearContents
Call overallRefresh
Call bufferRunSelangor
Call bufferRunKurnetto
End Sub
'Overall Refresh Every 30 Minutes
Sub overallRefresh()
ActiveWorkbook.refreshAll
Call scheduleRefresh
End Sub
Sub scheduleRefresh()
timeStore1 = Now + TimeValue("00:30:00")
Application.OnTime timeStore1, "overallRefresh"
End Sub
'Region Selangor Transfer Data
Sub bufferRunSelangor()
timeStore2 = Now + TimeValue("00:01:00")
Application.OnTime timeStore2, "startCopySelangor1"
End Sub
Sub startCopySelangor1()
Range("G3:G28").Value = Range("P3:P28").Value
timeStore2 = Now + TimeValue("01:00:00")
Application.OnTime timeStore2, "startCopySelangor2"
End Sub
Sub startCopySelangor2()
Range("K3:K28").Value = Range("P3:P28").Value
timeStore2 = Now + TimeValue("01:00:00")
Application.OnTime timeStore2, "startCopySelangor3"
End Sub
Sub startCopySelangor3()
Range("G31:G56").Value = Range("P3:P28").Value
timeStore2 = Now + TimeValue("01:00:00")
Application.OnTime timeStore2, "startCopySelangor4"
End Sub
Sub startCopySelangor4()
Range("K31:K56").Value = Range("P3:P28").Value
Range("G3:G28").Value = Range("K31:K56").Value
timeStore2 = Now + TimeValue("01:00:00")
Application.OnTime timeStore2, "startCopySelangor2"
End Sub
'Player Kurnetto Transfer Data
Sub bufferRunKurnetto()
timeStore3 = Now + TimeValue("00:00:50")
Application.OnTime timeStore3, "startCopyKurnetto1"
End Sub
Sub startCopyKurnetto1()
Range("G70").Value = Range("B91").Value
Range("K70").Value = Range("B131").Value
timeStore3 = Now + TimeValue("00:30:00")
Application.OnTime timeStore3, "startCopyKurnetto2"
End Sub
Sub startCopyKurnetto2()
Range("G71").Value = Range("B91").Value
Range("K71").Value = Range("B131").Value
timeStore3 = Now + TimeValue("00:30:00")
Application.OnTime timeStore3, "startCopyKurnetto3"
End Sub
Sub startCopyKurnetto3()
Range("G72").Value = Range("B91").Value
Range("K72").Value = Range("B131").Value
timeStore3 = Now + TimeValue("00:30:00")
Application.OnTime timeStore3, "startCopyKurnetto4"
End Sub
Sub startCopyKurnetto4()
Range("G73").Value = Range("B91").Value
Range("K73").Value = Range("B131").Value
timeStore3 = Now + TimeValue("00:30:00")
Application.OnTime timeStore3, "startCopyKurnetto5"
End Sub
Sub startCopyKurnetto5()
Range("G74").Value = Range("B91").Value
Range("K74").Value = Range("B131").Value
timeStore3 = Now + TimeValue("00:30:00")
Application.OnTime timeStore3, "startCopyKurnetto6"
End Sub
Sub startCopyKurnetto6()
Range("G75").Value = Range("B91").Value
Range("K75").Value = Range("B131").Value
timeStore3 = Now + TimeValue("00:30:00")
Application.OnTime timeStore3, "startCopyKurnetto7"
End Sub
Sub startCopyKurnetto7()
Range("G76").Value = Range("B91").Value
Range("K76").Value = Range("B131").Value
timeStore3 = Now + TimeValue("00:30:00")
Application.OnTime timeStore3, "startCopyKurnetto8"
End Sub
Sub startCopyKurnetto8()
Range("G77").Value = Range("B91").Value
Range("K77").Value = Range("B131").Value
timeStore3 = Now + TimeValue("00:30:00")
Application.OnTime timeStore3, "startCopyKurnetto9"
End Sub
Sub startCopyKurnetto9()
Range("G78").Value = Range("B91").Value
Range("K78").Value = Range("B131").Value
timeStore3 = Now + TimeValue("00:30:00")
Application.OnTime timeStore3, "startCopyKurnetto10"
End Sub
Sub startCopyKurnetto10()
Range("G79").Value = Range("B91").Value
Range("K79").Value = Range("B131").Value
timeStore3 = Now + TimeValue("00:30:00")
Application.OnTime timeStore3, "startCopyKurnetto11"
End Sub
Sub startCopyKurnetto11()
Range("G80").Value = Range("B91").Value
Range("K80").Value = Range("B131").Value
timeStore3 = Now + TimeValue("00:30:00")
Application.OnTime timeStore3, "startCopyKurnetto12"
End Sub
Sub startCopyKurnetto12()
Range("G81").Value = Range("B91").Value
Range("K81").Value = Range("B131").Value
timeStore3 = Now + TimeValue("00:30:00")
Application.OnTime timeStore3, "startCopyKurnetto13"
End Sub
Sub startCopyKurnetto13()
Range("G82").Value = Range("B91").Value
Range("K82").Value = Range("B131").Value
timeStore3 = Now + TimeValue("00:30:00")
Application.OnTime timeStore3, "startCopyKurnetto14"
End Sub
Sub startCopyKurnetto14()
Range("G83").Value = Range("B91").Value
Range("K83").Value = Range("B131").Value
timeStore3 = Now + TimeValue("00:30:00")
Application.OnTime timeStore3, "startCopyKurnetto15"
End Sub
Sub startCopyKurnetto15()
Range("G84").Value = Range("B91").Value
Range("K84").Value = Range("B131").Value
timeStore3 = Now + TimeValue("00:30:00")
Application.OnTime timeStore3, "startCopyKurnetto16"
End Sub
Sub startCopyKurnetto16()
Range("G85").Value = Range("B91").Value
Range("K85").Value = Range("B131").Value
timeStore3 = Now + TimeValue("00:30:00")
Application.OnTime timeStore3, "startCopyKurnetto17"
End Sub
Sub startCopyKurnetto17()
Range("G86").Value = Range("B91").Value
Range("K86").Value = Range("B131").Value
timeStore3 = Now + TimeValue("00:30:00")
Application.OnTime timeStore3, "startCopyKurnetto18"
End Sub
Sub startCopyKurnetto18()
Range("G87").Value = Range("B91").Value
Range("K87").Value = Range("B131").Value
timeStore3 = Now + TimeValue("00:30:00")
Application.OnTime timeStore3, "startCopyKurnetto19"
End Sub
Sub startCopyKurnetto19()
Range("G88").Value = Range("B91").Value
Range("K88").Value = Range("B131").Value
timeStore3 = Now + TimeValue("00:30:00")
Application.OnTime timeStore3, "startCopyKurnetto20"
End Sub
Sub startCopyKurnetto20()
Range("G89").Value = Range("B91").Value
Range("K89").Value = Range("B131").Value
timeStore3 = Now + TimeValue("00:30:00")
Application.OnTime timeStore3, "startCopyKurnetto21"
End Sub
Sub startCopyKurnetto21()
Range("G90").Value = Range("B91").Value
Range("K90").Value = Range("B131").Value
timeStore3 = Now + TimeValue("00:30:00")
Application.OnTime timeStore3, "startCopyKurnetto22"
End Sub
Sub startCopyKurnetto22()
Range("G91").Value = Range("B91").Value
Range("K91").Value = Range("B131").Value
timeStore3 = Now + TimeValue("00:30:00")
Application.OnTime timeStore3, "startCopyKurnetto23"
End Sub
Sub startCopyKurnetto23()
Range("G92").Value = Range("B91").Value
Range("K92").Value = Range("B131").Value
timeStore3 = Now + TimeValue("00:30:00")
Application.OnTime timeStore3, "startCopyKurnetto24"
End Sub
Sub startCopyKurnetto24()
Range("G93").Value = Range("B91").Value
Range("K93").Value = Range("B131").Value
timeStore3 = Now + TimeValue("00:30:00")
Application.OnTime timeStore3, "startCopyKurnetto1"
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 Then
Cells(Target.Row, 5).Value = Now
End If
If Target.Column = 7 Then
Cells(Target.Row, 8).Value = Now
End If
If Target.Column = 11 Then
Cells(Target.Row, 12).Value = Now
End If
If Target.Column = 15 Then
Cells(Target.Row, 16).Value = Now
End If
If Target.Column = 19 Then
Cells(Target.Row, 20).Value = Now
End If
End Sub
Recent comments
5 years 41 weeks ago
6 years 27 weeks ago
6 years 39 weeks ago
6 years 42 weeks ago
6 years 43 weeks ago
6 years 48 weeks ago
7 years 4 weeks ago
7 years 5 weeks ago
7 years 5 weeks ago
7 years 5 weeks ago