Я работаю над некоторым кодированием для работы и сталкиваюсь с некоторыми проблемами. Довольно плохо знакомы с кодированием и некоторая помощь будет здорово. Я получаю сообщение об ошибке "13" во время выполнения ошибки несоответствующего типа в областях eqp, si, fdp, seat и leg. На моем другом макросе он работает отлично и данные захватывают цифры. Это, вероятно, что-то незначительное, если вам нужно больше кода, пожалуйста, дайте мне знать, нужно будет редактировать части из-за характера работы.
Dim rap As Variant
Dim fdp As Variant
Dim cfdp As Variant
Dim si As Variant
Dim seat As Variant
Dim eqp As Variant
Dim leg As Variant
Dim result As String
Base = Range("a2:a500000")
eqp = Range("b2:b500000").Value '' identify equipment
si = Range("c2:c500000").Value '' Time at which the sequence and fdp start
fdp = Range("d2:d500000").Value '' fdp for the first day of the sequence
seat = Range("e2:e500000").Value '' number of seat position
leg = Range("f2:f500000").Value '' fdp per far part 117 table b chart
If seat = "3" Or "4" Then
If eqp = "757" Then
If si >= 0 Then
If si <= 559 Then
If seat = 3 Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("h18").Value
ElseIf seat = 4 Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("g18").Value
End If
ElseIf si >= 600 Then
If si <= 659 Then
If seat = 3 Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("f19").Value
ElseIf seat = 4 Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("g19").Value
End If
ElseIf si >= 700 Then
If si <= 1259 Then
If seat = 3 Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("f20").Value
ElseIf seat = 4 Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("g20").Value
End If
ElseIf si >= 1300 Then
If si <= 1659 Then
If seat = 3 Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("f21").Value
ElseIf seat = 4 Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("g21").Value
End If
ElseIf si >= 1700 Then
If si <= 2359 Then
If seat = 3 Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("f22").Value
ElseIf seat = 4 Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("g22").Value
End If
End If
End If
End If
End If
End If
End If
ElseIf eqp = "330" Or "767" Then
If si >= 0 Then
If si <= 559 Then
If seat = 3 Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("d18").Value
ElseIf seat = 4 Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("e18").Value
End If
ElseIf si >= 600 Then
If si <= 659 Then
If seat = 3 Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("d19").Value
ElseIf seat = 4 Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("e19").Value
End If
ElseIf si >= 700 Then
If si <= 1259 Then
If seat = 3 Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("d20").Value
ElseIf seat = 4 Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("e20").Value
End If
ElseIf si >= 1300 Then
If si <= 1659 Then
If seat = 3 Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("d21").Value
ElseIf seat = 4 Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("e21").Value
End If
ElseIf si >= 1700 Then
If si <= 2359 Then
If seat = 3 Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("d22").Value
ElseIf seat = 4 Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("e22").Value
End If
End If
End If
End If
End If
End If
End If
ElseIf eqp = "777" Or "787" Then
If si >= 0 Then
If si <= 559 Then
If seat = 3 Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("b18").Value
ElseIf seat = 4 Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("c18").Value
End If
ElseIf si >= 600 Then
If si <= 659 Then
If seat = 3 Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("b19").Value
ElseIf seat = 4 Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("c19").Value
End If
ElseIf si >= 700 Then
If si <= 1259 Then
If seat = 3 Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("b20").Value
ElseIf seat = 4 Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("c20").Value
End If
ElseIf si >= 1300 Then
If si <= 1659 Then
If seat = 3 Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("b21").Value
ElseIf seat = 4 Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("c21").Value
End If
ElseIf si >= 1700 Then
If si <= 2359 Then
If seat = 3 Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("b22").Value
ElseIf seat = 4 Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("c22").Value
End If
End If
End If
End If
End If
End If
End If
End If
If seat = "2" Then
If si >= 0 Then
If si <= 359 Then
If leg = "1" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("b5").Value
ElseIf leg = "2" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("c5").Value
ElseIf leg = "3" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("d5").Value
ElseIf leg = "4" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("e5").Value
ElseIf leg = "5" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("f5").Value
ElseIf leg = "6" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("g5").Value
ElseIf leg = "7" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("h5").Value
End If
ElseIf si >= 400 Then
If si <= 459 Then
If leg = "1" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("b6").Value
ElseIf leg = "2" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("c6").Value
ElseIf leg = "3" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("d6").Value
ElseIf leg = "4" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("e6").Value
ElseIf leg = "5" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("f6").Value
ElseIf leg = "6" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("g6").Value
ElseIf leg = "7" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("h6").Value
End If
ElseIf si >= 500 Then
If si <= 559 Then
If leg = "1" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("b7").Value
ElseIf leg = "2" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("c7").Value
ElseIf leg = "3" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("d7").Value
ElseIf leg = "4" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("e7").Value
ElseIf leg = "5" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("f7").Value
ElseIf leg = "6" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("g7").Value
ElseIf leg = "7" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("h7").Value
End If
ElseIf si >= 600 Then
If si <= 659 Then
If leg = "1" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("b8").Value
ElseIf leg = "2" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("c8").Value
ElseIf leg = "3" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("d8").Value
ElseIf leg = "4" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("e8").Value
ElseIf leg = "5" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("f8").Value
ElseIf leg = "6" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("g8").Value
ElseIf leg = "7" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("h8").Value
End If
ElseIf si >= 700 Then
If si <= 1159 Then
If leg = "1" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("b9").Value
ElseIf leg = "2" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("c9").Value
ElseIf leg = "3" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("d9").Value
ElseIf leg = "4" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("e9").Value
ElseIf leg = "5" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("f9").Value
ElseIf leg = "6" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("g9").Value
ElseIf leg = "7" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("h9").Value
End If
ElseIf si >= 1200 Then
If si <= 1259 Then
If leg = "1" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("b10").Value
ElseIf leg = "2" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("c10").Value
ElseIf leg = "3" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("d10").Value
ElseIf leg = "4" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("e10").Value
ElseIf leg = "5" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("f10").Value
ElseIf leg = "6" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("g10").Value
ElseIf leg = "7" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("h10").Value
End If
ElseIf si >= 1300 Then
If si <= 1659 Then
If leg = "1" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("b11").Value
ElseIf leg = "2" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("c11").Value
ElseIf leg = "3" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("d11").Value
ElseIf leg = "4" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("e11").Value
ElseIf leg = "5" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("f11").Value
ElseIf leg = "6" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("g11").Value
ElseIf leg = "7" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("h11").Value
End If
ElseIf si >= 1700 Then
If si <= 2159 Then
If leg = "1" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("b12").Value
ElseIf leg = "2" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("c12").Value
ElseIf leg = "3" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("d12").Value
ElseIf leg = "4" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("e12").Value
ElseIf leg = "5" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("f12").Value
ElseIf leg = "6" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("g12").Value
ElseIf leg = "7" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("h12").Value
End If
ElseIf si >= 2200 Then
If si <= 2259 Then
If leg = " 1" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("b13").Value
ElseIf leg = "2" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("c13").Value
ElseIf leg = "3" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("d13").Value
ElseIf leg = "4" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("e13").Value
ElseIf leg = "5" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("f13").Value
ElseIf leg = "6" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("g13").Value
ElseIf leg = "7" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("h13").Value
End If
ElseIf si >= 2300 Then
If si <= 2359 Then
If leg = "1" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("b14").Value
ElseIf leg = "2" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("c14").Value
ElseIf leg = "3" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("d14").Value
ElseIf leg = "4" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("e14").Value
ElseIf leg = "5" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("f14").Value
ElseIf leg = "6" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("g14").Value
ElseIf leg = "7" Then
cfdp = ThisWorkbook.Sheets("FAR117Chart").Range("h14").Value
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Base = "LGA" Or "LAX" Then
If 200 < Abs(si - 400) Then
If fdp < Abs((200 - si) - cfdp) Then
result = "0200"
End If
ElseIf 300 < Abs(si - 400) Then
If fdp < Abs((400 - si) - cfdp) Then
result = "0400"
End If
ElseIf 400 < Abs(si - 400) Then
If fdp < Abs((400 - si) - cfdp) Then
result = "0400"
End If
ElseIf 500 < Abs(si - 400) Then
If fdp < Abs((500 - si) - cfdp) Then
result = "0500"
End If
ElseIf 600 < Abs(si - 400) Then
If fdp < Abs((600 - si) - cfdp) Then
result = "0600"
End If
ElseIf 700 < Abs(si - 400) Then
If fdp < Abs((700 - si) - cfdp) Then
result = "0700"
End If
ElseIf 800 < Abs(si - 400) Then
If fdp < Abs((800 - si) - cfdp) Then
result = "0800"
End If
ElseIf 900 < Abs(si - 400) Then
If fdp < Abs((900 - si) - cfdp) Then
result = "0900"
End If
ElseIf 1000 < Abs(si - 400) Then
If fdp < Abs((1000 - si) - cfdp) Then
result = "1000"
End If
ElseIf 1100 < Abs(si - 400) Then
If fdp < Abs(((1100 - si)) - cfdp) Then
result = "1100"
End If
ElseIf 1200 < Abs(si - 400) Then
If fdp < Abs((1200 - si) - cfdp) Then
result = "1200"
End If
ElseIf 1400 < Abs(si - 400) Then
If fdp < Abs((1400 - si) - cfdp) Then
result = "1400"
End If
ElseIf 1400 < Abs(si - 400) Then
If fdp < Abs((1400 - si) - cfdp) Then
result = "1400"
End If
ElseIf 1500 < Abs(si - 400) Then
If fdp < Abs((1500 - si) - cfdp) Then
result = "1500"
End If
ElseIf 1600 < Abs(si - 400) Then
If fdp < Abs((1600 - si) - cfdp) Then
result = "1600"
End If
ElseIf 1700 < Abs(si - 400) Then
If fdp < Abs((1700 - si) - cfdp) Then
result = "1700"
End If
ElseIf 1800 < Abs(si - 400) Then
If fdp < Abs((1800 - si) - cfdp) Then
result = "1800"
End If
ElseIf 1900 < Abs(si - 400) Then
If fdp < Abs((1900 - si) - cfdp) Then
result = "1900"
End If
ElseIf 2000 < Abs(si - 400) Then
If fdp < Abs((2000 - si) - cfdp) Then
result = "2000"
End If
ElseIf 2100 < Abs(si - 400) Then
If fdp < Abs((2100 - si) - cfdp) Then
result = "2100"
End If
ElseIf 200 < Abs(Abs(si - 300)) Then
If fdp < Abs((200 - si) - cfdp) Then
result = "0200"
End If
ElseIf 300 < Abs(si - 300) Then
If fdp < Abs((300 - si) - cfdp) Then
result = "0300"
End If
ElseIf 400 < Abs(si - 300) Then
If fdp < Abs((400 - si) - cfdp) Then
result = "0400"
End If
ElseIf 500 < Abs(si - 300) Then
If fdp < Abs((500 - si) - cfdp) Then
result = "0500"
End If
ElseIf 600 < Abs(si - 300) Then
If fdp < Abs((600 - si) - cfdp) Then
result = "0600"
End If
ElseIf 700 < Abs(si - 300) Then
If fdp < Abs((700 - si) - cfdp) Then
result = "0700"
End If
ElseIf 800 < Abs(si - 300) Then
If fdp < Abs((800 - si) - cfdp) Then
result = "0800"
End If
ElseIf 900 < Abs(si - 300) Then
If fdp < Abs((900 - si) - cfdp) Then
result = "0900"
End If
ElseIf 1000 < Abs(si - 300) Then
If fdp < Abs((1000 - si) - cfdp) Then
result = "1000"
End If
ElseIf 1100 < Abs(si - 300) Then
If fdp < Abs(((1100 - si)) - cfdp) Then
result = "1100"
End If
ElseIf 1200 < Abs(si - 300) Then
If fdp < Abs((1200 - si) - cfdp) Then
result = "1200"
End If
ElseIf 1300 < Abs(si - 300) Then
If fdp < Abs((1300 - si) - cfdp) Then
result = "1300"
End If
ElseIf 1400 < Abs(si - 300) Then
If fdp < Abs((1400 - si) - cfdp) Then
result = "1400"
End If
ElseIf 1500 < Abs(si - 300) Then
If fdp < Abs((1500 - si) - cfdp) Then
result = "1500"
End If
ElseIf 1600 < Abs(si - 300) Then
If fdp < Abs((1600 - si) - cfdp) Then
result = "1600"
End If
ElseIf 1700 < Abs(si - 300) Then
If fdp < Abs((1700 - si) - cfdp) Then
result = "1700"
End If
ElseIf 1800 < Abs(si - 300) Then
If fdp < Abs((1800 - si) - cfdp) Then
result = "1800"
End If
ElseIf 1900 < Abs(si - 300) Then
If fdp < Abs((1900 - si) - cfdp) Then
result = "1900"
End If
ElseIf 2000 < Abs(si - 300) Then
If fdp < Abs((2000 - si) - cfdp) Then
result = "2000"
End If
ElseIf 2100 < Abs(si - 300) Then
If fdp < Abs((2100 - si) - cfdp) Then
result = "2100"
End If
Range("j2:j500000").Value = result
End If
End If
End Sub