作者:
darklimit (darklimit)
2020-11-11 22:58:28各位大神
目前有個小需求是需要複製貼上
但For的寫法變成只是照貼
For i = 2 to 4
For j = 2 to 5
If sheet1.Cells(i,j) <> Sheet2.Cells(i,j) Then
Sheet1.Cells(i,j).Copy
Sheet2.Cells(i,j).PasteSpecial
Sheet1
10/1 10/2 10/3 10/4
A 1 1 1 1
B 2 2 2 2
C 3 3 3 3
Sheet2 資料只有首欄A, C, B及日期資訊,內容為空白
需要將Sheet1的資料貼到Sheet2
但因為首欄資料順序會變動,需要比對首欄後在貼上後面的值
現在的寫法結果是變成照貼,結果就會錯誤
C 應該是要3 B應該是要貼2,不知道應該怎麼修改才好?
麻煩各位大神提供建議,謝謝
Sheet2
10/1 10/2 10/3 10/4
A 1 1 1 1
C 2 2 2 2
B 3 3 3 3