Copy Paste Using Timer for Graph Visualizations

We can copy paste using timer for graph visualizations and data visualizations. Let’s take an example of a line graph defined by the equation: y =mx +c where x and y define the two points of the line, m defines the slope (how steep the line is) and c defines the y intercept i. e. ¬†where the line crosses the y-axis. By making changes in the m value with time we can visualize how the straight-line graph step by step.

Watch the training video below and then look at the detailed VBA code:

This learning video is also available on YouTube.

Public nextRow, Lrow

Sub copypasteUsingTimer()
Dim LastRow
LastRow = Range(“A” & Rows.Count).End(xlUp).Row
Lrow = LastRow
Range(“A” & nextRow + 1).Copy Destination:=Range(“b2”)
End Sub

Sub myTimer()
If nextRow + 1 = Lrow Then
nextRow = 1
Exit Sub

nextRow = nextRow + 1

Application.OnTime Now + TimeValue(“00:00:02”), “copypasteUsingTimer”

End If
End Sub

Further reference:

Find Last Row

Using Timer