sassriverrat
Well-known Member
- Joined
- Oct 4, 2018
- Messages
- 655
Good Afternoon,
I keep getting a "error 13" Type mismatch for the piece of coding below and I'm not sure why. These are calculators just doing speed*time=distance and variations of that simple formula.
Ideas?
I keep getting a "error 13" Type mismatch for the piece of coding below and I'm not sure why. These are calculators just doing speed*time=distance and variations of that simple formula.
Ideas?
Code:
Sub ETA_CALC1()Dim name As String
name = Sheets("Notes").Range("N4")
Dim Path1 As Double
Dim Path2 As Date
Dim Path3 As Double
Dim Path4 As Double
Dim Path5 As Double
Dim path6 As Double
Dim Path7 As Date
Dim Path8 As Date
Dim DTG As Double
Dim resp As Integer
'This says that the Distance to go should be in D10 but if we want to use a different mileage than what today's report had list, _
(D10 is on the list), we can input into S32 to use our own distance
'This piece ensures "ETA Arrival ZD" is ready
Worksheets("Developer").Range("F3").FormulaR1C1 = "=IF(AND((Notes!R[10]C[6]+Notes!R[10]C[7])<((R[2]C[-3]+R[2]C[-2])),(Notes!R[11]C[6]+Notes!R[11]C[7])>((R[2]C[-3]+R[2]C[-2]))),""Yes"",""No"")"
If ActiveSheet.Range("S29").Value = "" Then
DTG = ActiveSheet.Range("D10").Value
Else: DTG = ActiveSheet.Range("S29").Value
End If
Path1 = MilitarytoTime(ActiveSheet.Range("R28").Value)
Path2 = ActiveSheet.Range("T28").Value
Path3 = DTG
Path5 = Sheets("Developer").Range("G2").Value
path6 = ActiveSheet.Range("C5").Value
Path7 = ActiveSheet.Range("F4").Value
Path8 = ActiveSheet.Range("D4").Value
Path4 = (Path3 / (((Path2 + Path1 + (TimeSerial(Path5, 0, 0))) - (Path7 + Path8 + (TimeSerial(path6, 0, 0)))) * 24))
resp = MsgBox("Based on your desired Arrival Time/Date and your mileage input, your speed required to make your ETA is: " & Round(Path4, 1) & " knots" & vbCrLf & vbCrLf & "Would you like to use this ETA for Today's Report?", vbYesNo, name)
If resp = vbYes Then
ActiveSheet.Range("W33").Value = Format(Path1, "hh:mm;@")
ActiveSheet.Range("Y33:Z33").Value = Path2
End If
ActiveSheet.Range("R29").Select
End Sub