如果您的第一张工作表 (Sheet1) 如下所示:
A1: -- Running case : 03_mileage.cry ......
A2: Result : OK
A3: -- Running case : 07_option mode.cry ......
A4: Result : OK
A5: -- Running case : 10_80 columns.cry ......
A6: Result : OK
A7: -- Running case : 11_Split tag.cry ......
A8: Result : OK
A9: -- Running case : 12_TQC.cry ......
A10: Result : ERROR
然后,在新的电子表格上(在同一个工作簿中),您可以像这样引用另一个工作表的范围:
A1: =Sheet1!A1 B1: =Sheet1!A2
A2: =Sheet1!A3 B2: =Sheet1!A4
A3: =Sheet1!A5 B3: =Sheet1!A6
A4: =Sheet1!A7 B4: =Sheet1!A8
A5: =Sheet1!A9 B5: =Sheet1!A10
就这样……
或者,如果您的第一张工作表中有大量数据,您可以使用
VBA来完成这项工作。
Option Explicit
Sub CaseDesc()
Application.ScreenUpdating = False
Dim ws1 As Worksheet, ws2 As Worksheet, lr&, i&, nxt&
Set ws1 = ThisWorkbook.Sheets("Sheet1")
Set ws2 = ThisWorkbook.Sheets("Sheet2")
lr = ws1.Range("A" & Rows.Count).End(xlUp).Row
nxt = 1
' if you have headers change 1 to 2 ( or row where your data starts)
For i = 1 To lr
If i Mod 2 Then
ws2.Range("A" & ws2.Range("A" & Rows.Count).End(xlUp).Row + 1).Value = ws1.Range("A" & i).Value
Else
ws2.Range("B" & ws2.Range("B" & Rows.Count).End(xlUp).Row + 1).Value = ws1.Range("A" & i).Value
End If
Next i
Application.ScreenUpdating = True
End Sub