VBA xode snippet for iterating through colums

Private Sub CommandButton1_Click()
CalculateAndDispalyDifference
End Sub

Sub CalculateAndDispalyDifference()
Dim t1, t2 As Date

For counter = 2 To 91
t1 = Worksheets("Sheet1").Cells(counter, 2).Value //.Cells(row,column)
t2 = Worksheets("Sheet1").Cells(counter, 4).Value
If t2 > t1 Then
Worksheets("Sheet1").Cells(counter, 5).Value = t2 - t1
Else
Worksheets("Sheet1").Cells(counter, 5).Value = t1 - t2
End If

Next counter

End Sub

Comments

Popular posts from this blog

OpenLayers Advanced Clustering and Setting dynamic images for OpenLayer Styles via Ajax

Long running Java process resource consumption monitoring , leak detection and GC tuning

Compiling OpenCV with CUDA (GPU) using CMake (GUI)