Macro STR_CaDistxxx. Usage:
Cauton:
Sub Str_CaDist() 'Dist=Sqr((x-x(av))^2+(y-y(av))^2+(z-z(av))^2) 'get extent of current selection i1 = Selection.Row i2 = i1 + Selection.Rows.Count - 1 j1 = Selection.Column j2 = j1 + Selection.Columns.Count - 1 Sheets.Add ActiveSheet.Name = "Dist" For i = i1 To i2 Step 1 For j = j1 To j2 Step 1 If IsEmpty(Sheets("X").Cells(i, j)) Then Else dx = Sheets("X").Cells(i, j) - Sheets("X").Cells(i, j2 + 2) dy = Sheets("Y").Cells(i, j) - Sheets("Y").Cells(i, j2 + 2) dz = Sheets("Z").Cells(i, j) - Sheets("Z").Cells(i, j2 + 2) Sheets("Dist").Cells(i, j) = Sqr((dx * dx) + (dx * dx) + (dz * dz)) End If Next j Next i End Sub |
|
|||||||||||||||||
Last Modified by A.Honegger |