Function IsInside(Area As String, Rectangle As String) As Boolean
Dim Parts() As String
Dim Line1 As String, Line2 As String, Lx1 As Single, Ly1 As Single, Lx2 As String, Ly2 As String
Dim Rect1 As String, Rect2 As String, Rx1 As Single, Ry1 As Single, Rx2 As String, Ry2 As String
On Error Resume Next
Parts = Split(Replace(Area, " ", ""), "/")
Line1 = Parts(0)
Line2 = Parts(1)
If InStr(1, Line1, "-", vbTextCompare) > 0 Then
Parts = Split(Line1, "-")
Lx1 = Parts(0)
Ly1 = Parts(1)
Else
Lx1 = Line1
Ly1 = "0"
End If
If InStr(1, Line2, "-", vbTextCompare) > 0 Then
Parts = Split(Line2, "-")
Lx2 = Parts(0)
Ly2 = Parts(1)
Else
Lx2 = Line2
Ly2 = 0
End If
Parts = Split(Replace(Rectangle, " ", ""), "/")
Rect1 = Parts(0)
Rect2 = Parts(1)
If InStr(1, Rect1, "-", vbTextCompare) > 0 Then
Parts = Split(Rect1, "-")
Rx1 = Parts(0)
Ry1 = Parts(1)
Else
Rx1 = Rect1
Ry1 = 0
End If
If InStr(1, Rect2, "-", vbTextCompare) > 0 Then
Parts = Split(Rect2, "-")
Rx2 = Parts(0)
Ry2 = Parts(1)
Else
Rx2 = Rect2
Ry2 = 0
End If
If Lx1 > 0 And Ly1 > 0 And Lx2 > 0 And Ly2 > 0 And Rx1 > 0 And Ry1 > 0 And Rx2 > 0 And Ry2 > 0 Then
IsInside = Lx1 >= Rx1 And Lx1 <= Ry1 And Lx2 >= Rx2 And Lx2 <= Ry2
ElseIf Lx1 > 0 And Ly1 = 0 And Lx2 > 0 And Ly2 > 0 And Rx1 > 0 And Ry1 > 0 And Rx2 > 0 And Ry2 > 0 Then
IsInside = Lx1 >= Rx1 And Lx1 <= Ry1 And Lx2 >= Rx2 And Ly2 <= Ry2
ElseIf Lx1 > 0 And Ly1 = 0 And Lx2 > 0 And Ly2 = 0 And Rx1 > 0 And Ry1 > 0 And Rx2 > 0 And Ry2 > 0 Then
IsInside = Lx1 >= Rx1 And Lx1 <= Ry1 And Lx2 >= Rx2 And Lx2 <= Ry2
ElseIf Lx1 > 0 And Ly1 > 0 And Lx2 > 0 And Ly2 > 0 And Rx1 > 0 And Ry1 = 0 And Rx2 > 0 And Ry2 > 0 Then
IsInside = 0
ElseIf Lx1 > 0 And Ly1 = 0 And Lx2 > 0 And Ly2 > 0 And Rx1 > 0 And Ry1 = 0 And Rx2 > 0 And Ry2 > 0 Then
IsInside = Lx1 = Rx1 And Lx2 >= Rx2 And Ly2 <= Ry2
ElseIf Lx1 > 0 And Ly1 = 0 And Lx2 > 0 And Ly2 = 0 And Rx1 > 0 And Ry1 = 0 And Rx2 > 0 And Ry2 > 0 Then
IsInside = Lx1 = Rx1 And Lx2 >= Rx2 And Lx2 <= Ry2
ElseIf Lx1 > 0 And Ly1 > 0 And Lx2 > 0 And Ly2 > 0 And Rx1 > 0 And Ry1 = 0 And Rx2 > 0 And Ry2 = 0 Then
IsInside = 0
ElseIf Lx1 > 0 And Ly1 = 0 And Lx2 > 0 And Ly2 > 0 And Rx1 > 0 And Ry1 = 0 And Rx2 > 0 And Ry2 = 0 Then
IsInside = 0
ElseIf Lx1 > 0 And Ly1 = 0 And Lx2 > 0 And Ly2 = 0 And Rx1 > 0 And Ry1 = 0 And Rx2 > 0 And Ry2 = 0 Then
IsInside = 0
ElseIf Lx1 > 0 And Ly1 > 0 And Lx2 > 0 And Ly2 > 0 And Rx1 > 0 And Ry1 > 0 And Rx2 > 0 And Ry2 = 0 Then
IsInside = 0
ElseIf Lx1 > 0 And Ly1 = 0 And Lx2 > 0 And Ly2 > 0 And Rx1 > 0 And Ry1 > 0 And Rx2 > 0 And Ry2 = 0 Then
IsInside = 0
ElseIf Lx1 > 0 And Ly1 = 0 And Lx2 > 0 And Ly2 = 0 And Rx1 > 0 And Ry1 > 0 And Rx2 > 0 And Ry2 = 0 Then
IsInside = 0
Else
End If
End Function