- 帖子
- 234
- 主題
- 19
- 精華
- 0
- 積分
- 276
- 點名
- 0
- 作業系統
- Windows XP
- 軟體版本
- office 2003
- 閱讀權限
- 20
- 性別
- 男
- 註冊時間
- 2013-1-7
- 最後登錄
- 2021-10-7
|
6#
發表於 2021-3-11 08:57
| 只看該作者
回復 5# dou10801
5選2
Sub ex1()
Dim a As Object, b As Object, X%, Y%
Range([a7], [a7].End(4)).Clear
Y = 7
For Each a In [a1].CurrentRegion.Columns
For Each b In a.Rows
For X = b.Row + 1 To Cells(1, b.Column).End(4).Row
Cells(Y, 1) = "[" & Format(Cells(b.Row, b.Column), "0#") & "." & Format(Cells(X, b.Column), "0#") & "]"
Y = Y + 1
Next
Next
Next
End Sub
5選3
Sub ex2()
Dim a As Object, b As Object, X%, Y%
Range([a7], [a7].End(4)).Clear
Y = 7
For Each a In [a1].CurrentRegion.Columns
For Each b In a.Rows
For X = b.Row + 1 To Cells(1, b.Column).End(4).Row
If X + 1 <= Cells(1, b.Column).End(4).Row Then
Cells(Y, 1) = "[" & Format(Cells(b.Row, b.Column), "0#") & "." & Format(Cells(X, b.Column), "0#") & "." & Format(Cells(X + 1, b.Column), "0#") & "]"
Y = Y + 1
End If
Next
Next
Next
End Sub |
|