Excel VBA 编程
例:要将如下图的三维表改成一维表
按ALT+F11进入Excel VBA 编程模式
Sub 遍历()
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim irows As Integer
Dim icolumes As Integer
j = 2
irows = Worksheets("Test&Configuration Matrix").UsedRange.Rows.Count
icolumes = Worksheets("Test&Configuration Matrix").UsedRange.Columns.Count
For k = 4 To 58
For i = 9 To icolumes
If Worksheets("Test&Configuration Matrix").Cells(k, i) = "√" Then
Worksheets("Test&Configuration Matrix").Range("a" & k & ":" & "h" & k).Copy Worksheets("Tester case").Range("a" & j)
Worksheets("Test&Configuration Matrix").Cells(3, i).Copy Worksheets("Tester case").Cells(j, 10)
If i > 8 And i < 17 Then
Worksheets("Test&Configuration Matrix").Cells(2, 9).Copy Worksheets("Tester case").Cells(j, 9)