extrahotfudge
New Member
- Joined
- Apr 9, 2021
- Messages
- 10
- Office Version
- 365
- 2019
- Platform
- MacOS
ve four points (x1,y1), (x2,y2), (x3,y3), and (x4,y4). The first two points define line 1 and the last two points define line 2. I'm trying to use a user defined function to determine the status of the two lines, so either Parallel, Perpendiculr, or Neither. This is what I have for the code, but I am getting a #VALUE! Error. Anyone have any ideas on what to use?
VBA Code:
Option Explicit
Function Line_Status(x1, y2, x2, y2, x3, y3, x4, y4)
Dim s1 As Double
Dim s2 As Double
s1 = (y2 - y1) / (x2 - x1)
s2 = (y4 - y3) / (x4 - x3)
If s1 = s2 Then
Line_Status = "parallel"
If s1 / s2 = -1 Then
Line_Status = "Perpendicular"
Else
Line_Status = "Neither"
End If
End Funtion