- ©«¤l
- 552
- ¥DÃD
- 3
- ºëµØ
- 0
- ¿n¤À
- 578
- ÂI¦W
- 0
- §@·~¨t²Î
- win7
- ³nÅ骩¥»
- office 2010
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2015-2-8
- ³Ì«áµn¿ý
- 2024-7-9
|
¦^´_ 6# linlin00
¤£ª¾¬O¤£¬O§A·Qnªº
¨ä¹ê¥u¬O§â¥¦¥H°}¦Cªº¤è¦¡¥h¶](°}¦C¤ñ¦bÀx¦s®æ¶]§Ö«Ü¦h)- Public Sub Ex1()
- Dim ar1(), ar2()
- n = 1
- arr = Range("a2:c" & Cells(Rows.Count, 1).End(xlUp).Row) '·íABC¤TÄ橹¤U¼W¥[¸ê®Æ®É·|¦Û°ÊŪ¨ú¦ì¸m
- ReDim ar2(1 To UBound(arr) + 1, 1 To UBound(arr) + 1)
- ar2(1, 2) = 1
- For i = 1 To UBound(arr) - 1
- ar2(1, i + 2) = i + 1
- X = i + 1
- For j = X To UBound(arr)
- ReDim Preserve ar1(1 To 3, 1 To n)
- ar1(1, n) = arr(i, 1) & "," & arr(j, 1)
- ar1(2, n) = (arr(i, 2) + arr(j, 2)) / 2
- ar1(3, n) = (arr(i, 3) + arr(j, 3)) / 2
- ar2(j, 1) = j - 1
- ar2(j + 1, i + 1) = (arr(i, 2) - ar1(2, n)) ^ 2 _
- + (arr(j, 2) - ar1(2, n)) ^ 2 _
- + (arr(i, 3) - ar1(3, n)) ^ 2 _
- + (arr(j, 3) - ar1(3, n)) ^ 2
- n = n + 1
- Next
- Next
- ar2(j, 1) = i
- Range("F2").Resize(UBound(ar1, 2), UBound(ar1, 1)) = Application.Transpose(ar1)
- Range("J1").Resize(UBound(ar2, 2), UBound(ar2, 1)) = ar2
- End Sub
½Æ»s¥N½X |
|