Sub decmatch()
Application.ScreenUpdating = False
datalength = Cells(Rows.Count, 1).End(xlUp).Row 'STI data from access
impdatalength = Cells(Rows.Count, 18).End(xlUp).Row 'TX data from box
Dim dat As Variant
For o = 1 To impdatalength
dat = Cells(o, 18).Value
CDec (dat)
Cells(o, 17).Formula = "=Roundup(trunc(" & dat & ", 5),6)"
Next
Columns("q:q").Copy
Range("q1").PasteSpecial Paste:=xlValues
For i = 2 To datalength
dat = Cells(i, 2).Value / 86400 'convert time from seconds to days
CDec (dat)
Cells(i, 14).Formula = "=Roundup(trunc((" & dat & "), 5),6)"
Cells(i, 14).NumberFormat = "general"
Cells(i, 14).Copy
Cells(i, 14).PasteSpecial Paste:=xlValues
Cells(i, 15).Formula = "=vlookup(n" & i & ",q1:u" & impdatalength & ",5, false)"
Cells(i, 13).Formula = "=if(ISNA(o" & i & ")," & ",(o" & i & "))"
Next
Columns("M:M").Copy
Range("M1").PasteSpecial Paste:=xlValues
For i = 2 To datalength
If Cells(i, 13).Value = "0" Then
Cells(i, 13).Clear
End If
Next
Columns("o:o").Clear
Application.ScreenUpdating = True
End Sub
Bookmarks