Dear 大大們
小弟遇到列的複雜/刪除與匯入上的問題
詳述如下:
我需要將
1. Sheet1中有疑問的資料轉到sheet2中
2. 將Sheet1中有疑問的資料刪除 (因Sheet2的資料澄清後,需要在匯回Sheet1中,會避免資料重覆的情況下,需要先行刪除)
3.Sheet2的資料澄清後,需要在匯回Sheet1中 (還沒有寫)
我在VBA寫法
1.將Sheet1中有疑問的資料轉到sheet2中
x = 0
K = 0
Do Until Sheet1.Cells(7 + x, 12) = ""
If Sheet1.Cells(7 + x, 6) <> "" Then
Sheet1.Rows(7 + x).Copy
Sheet2.Select
Sheet2.Rows(7 + k).Select
ActiveSheet.Paste
k = k + 1
End If
2. 將Sheet1中有疑問的資料刪除
x = 0
Do Until Sheet1.Cells(7 + x, 12) = ""
For J = 0 To x
If Sheet1.Cells(7 + J, 6) <> "" Then
Sheet1.Rows(7 + J).Delete
End If
Next J
x = x + 1
Loop
可是這樣的寫法在執行上比較慢,請問大大是否有較好的方法
另外第3.將資料匯回sheet1也有點卡住,盼能夠有提點一下
這是我的寫法,不過我要貼的是從空白的地方接資料,但是執行後,檢查資料,卻沒有成功
x = 0
k = 0
Do Until Sheet2.Cells(7 + x, 6) = ""
If Sheet1.Cells(7 + k, 12) = "" Then
Sheet2.Rows(7 + x).Copy
Sheet1.Select
Sheet1.Rows(7 + k).Select
ActiveSheet.Paste
x = x + 1
End If
k = k + 1
Loop |