答案 0 :(得分:2)
计算AB的方向向量
Sub testFilFormulaDown()
Dim sh As Worksheet, lastRow As Long
Set sh = ActiveSheet 'use here the necessary sheet
lastRow = sh.Range("O" & rows.count).End(xlUp).row 'chosen O:O column, being involved in the formula...
sh.Range("AC5:AC" & lastRow).Formula = "=IF(ISBLANK(B5),"""",IF(ISBLANK(O5)=TRUE,""Missing PSD"",TODAY()-O5))"
End Sub
规格化(单位长度)
dx = b.x-a.x
dy = b.y-a.y
制作垂直向量
len = sqrt(dx*dx+dy*dy)
udx = dx / len
udy = dy / len
计算绿点
px = -udy
py = udx