
Option Explicit
Sub Calcola_col_F_G()
Dim i As Long
Columns("F:F").Select
Selection.NumberFormat = "[$-F400]h:mm:ss AM/PM"
Columns("G:G").Select
Selection.NumberFormat = "General"
[F1].Select
For i = 1 To Cells(Rows.Count, "A").End(xlUp).Row
If Cells(i + 1, "A") < 0.041666667 And Cells(i, "A") > 0.958333333 Then
Cells(i + 1, "F") = 0.999988426 - Cells(i, "A") + Cells(i + 1, "A")
Cells(i + 1, "G") = Cells(i + 1, "I") * 86400
ElseIf Cells(i + 1, "A") > Cells(i, "A") Then
Cells(i + 1, "F") = Cells(i + 1, "A") - Cells(i, "A")
Cells(i + 1, "G") = Cells(i + 1, "I") * 86400
Else
Cells(i + 1, "F") = ""
Cells(i + 1, "G") = ""
End If
Next i
End Sub
|
Option Explicit
Sub Calcola_col_F_G()
Dim i As Long
Columns("F:F").Select
Selection.NumberFormat = "[$-F400]h:mm:ss AM/PM"
Columns("G:G").Select
Selection.NumberFormat = "General"
[F1].Select
For i = 1 To Cells(Rows.Count, "A").End(xlUp).Row
If Cells(i + 1, "A") < 0.041666667 And Cells(i, "A") > 0.958333333 Then
Cells(i + 1, "F") = 0.999988426 - Cells(i, "A") + Cells(i + 1, "A")
Cells(i + 1, "G") = Cells(i + 1, "F") * 86400
ElseIf Cells(i + 1, "A") > Cells(i, "A") Then
Cells(i + 1, "F") = Cells(i + 1, "A") - Cells(i, "A")
Cells(i + 1, "G") = Cells(i + 1, "F") * 86400
Else
Cells(i + 1, "F") = ""
Cells(i + 1, "G") = ""
End If
Next i
End Sub |
Option Explicit
Sub Evaluate_F()
Dim x As String, y As String
With Range("A2:A" & Range("A" & Rows.Count).End(xlUp).Row)
x = .Address
y = .Offset(-1).Address
.Offset(, 5) = Evaluate("IF(AND(" & x & "<0.041666667," & y & ">0.958333333),0.999988426-" & x & "+" & y & ",IF(AND(" & x & ">" & y & ")," & x & "-" & y & ",""""))")
End With
End Sub
Sub Evaluate_G()
Dim x As String
With Range("F2:F" & Range("A" & Rows.Count).End(xlUp).Row)
x = .Address
.Offset(, 1) = Evaluate("if(isnumber(" & x & ")," & x & "*24*60*60,"""")")
End With
End Sub |
Option Explicit
Sub Evaluate_F()
Dim Rng()
Dim C As Long
Dim A As Double
Dim B As Double
Dim K As Double, L As Double, M As Double
K = 0.041666667
L = 0.958333333
M = 0.999988426
Columns("F:F").NumberFormat = "[$-F400]h:mm:ss AM/PM"
Rng = Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row)
ReDim arr(1 To UBound(Rng, 1), 1 To 1)
A = Rng(1, 1)
For C = 2 To UBound(Rng, 1)
B = Rng(C, 1)
If B < K And A > L Then
arr(C, 1) = M - A + B
Else
If B > A Then arr(C, 1) = B - A
End If
A = B
Next
Range("F1:F" & Range("A" & Rows.Count).End(xlUp).Row) = arr
End Sub
Sub Evaluate_G()
Columns("G:G").NumberFormat = "General"
Dim x As String
With Range("F2:F" & Range("A" & Rows.Count).End(xlUp).Row)
x = .Address
.Offset(, 1) = Evaluate("if(isnumber(" & x & ")," & x & "*86400,"""")")
End With
End Sub
|
Option Explicit
Sub Calcola_col_F_G()
Dim i As Long
Dim tempo
tempo = Now
''''''''
Application.Calculation = xlManual
'''''''''
Range("F:F") = ""
Selection.NumberFormat = "[$-F400]h:mm:ss AM/PM"
Range("G:G") = ""
Selection.NumberFormat = "General"
[F1].Select
For i = 1 To Cells(Rows.Count, "A").End(xlUp).Row
If Cells(i + 1, "A") < 0.041666667 And Cells(i, "A") > 0.958333333 Then
Cells(i + 1, "F") = 0.999988426 - Cells(i, "A") + Cells(i + 1, "A")
Cells(i + 1, "G") = Cells(i + 1, "F") * 86400
ElseIf Cells(i + 1, "A") > Cells(i, "A") Then
Cells(i + 1, "F") = Cells(i + 1, "A") - Cells(i, "A")
Cells(i + 1, "G") = Cells(i + 1, "F") * 86400
Else
Cells(i + 1, "F") = ""
Cells(i + 1, "G") = ""
End If
Next i
'''''''''
Application.Calculation = xlAutomatic
Calculate
[M1] = Now - tempo
End Sub
|
Option Explicit
Sub Evaluate_F()
Dim x As String, y As String
Columns("F:F").NumberFormat = "[$-F400]h:mm:ss AM/PM"
With Range("A2:A" & Range("A" & Rows.Count).End(xlUp).Row)
x = .Address
y = .Offset(-1).Address
.Offset(, 5) = Evaluate("IF(AND(" & x & "<0.041666667," & y & ">0.958333333),0.999988426-" & x & "+" & y & ",IF(" & x & ">" & y & "," & x & "-" & y & ",""""))")
End With
End Sub |
Sub Evaluate_F()
Dim tempo As Date
tempo = Now
Dim x As String, y As String
Columns("F:F").NumberFormat = "[$-F400]h:mm:ss AM/PM"
With Range("A2:A" & Range("A" & Rows.Count).End(xlUp).Row)
x = .Address
y = .Offset(-1).Address
.Offset(, 5) = Evaluate("IF(AND(" & x & "<0.041666667," & y & ">0.958333333),0.999988426-" & x & "+" & y & ",IF(" & x & ">" & y & "," & x & "-" & y & ",""""))")
End With
[I665763] = Now - tempo
End Sub
|
Option Explicit
Private Declare Function GetTickCount Lib "kernel32" () As Long
Sub Evaluate_F_G()
Dim Via As Variant
Dim Msec As Variant
Via = GetTickCount
Dim x As String, y As String
Columns("F:F").NumberFormat = "[$-F400]h:mm:ss AM/PM"
Columns("G:G").NumberFormat = "General"
With Range("A2:A" & Range("A" & Rows.Count).End(xlUp).Row)
x = .Address
y = .Offset(-1).Address
.Offset(, 5) = Evaluate("IF(AND(" & x & "<0.041666667," & y & ">0.958333333),0.999988426-" & x & "+" & y & ",IF(" & x & ">" & y & "," & x & "-" & y & ",""""))")
.Offset(, 6) = Evaluate(.Offset(, 5).Address & "*86400")
End With
Msec = GetTickCount - Via
MsgBox " " & Format$(Msec 3600000, "00") & ":" & Format$(((Msec - (Msec 3600000) * 3600000)) 60000, "00") & ":" & Format$((Msec - (Msec 60000) * 60000) / 1000, "00.000")
End Sub |
