如果你的第一個表(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
是的!這工作,謝謝 – Abhi 2013-04-19 09:36:23