I am trying the following code
Code: Select all
Sub Test()
Dim a, dic As Object, s As String, i As Long, j As Long
a = ThisWorkbook.Worksheets("Sheet1").Range("A1").CurrentRegion.Value
a = Application.Index(a, Evaluate("ROW(1:" & UBound(a, 1) & ")"), [{3,7,13,14,15,16,17,18,19,20,21}])
Set dic = CreateObject("Scripting.Dictionary")
dic.CompareMode = 1
For i = LBound(a) To UBound(a)
s = a(i, 1) & vbTab & a(i, 2)
If Not dic.Exists(s) Then
dic.Add s, s
For j = LBound(a, 2) To UBound(a, 2)
If j = 1 Or j = 3 Or j = 6 Or j = 9 Then
If i > 1 Then a(i, j) = CLng(Application.WorksheetFunction.WorkDay(CDate(a(i, 1)), IIf(j = 1, 0, Val(j / 3))))
End If
Next j
Else
'Need Here Some Help
Stop
End If
Next i
End Sub
If new then some calculations will be done ..on columns M to U
And if it is already exists, there is no need to do the calculations again .. just bring the results from the existing