返回列表 上一主題 發帖

同樣巨集另一檔案卻執行錯誤

試試這個:
  1. Option Explicit
  2. Sub nn()
  3. Dim Rng As Range, A As Range, cell As Range
  4. With Sheet6
  5. Set Rng = .Range(.[A1], .[A65536].End(xlUp))
  6. End With
  7. With Sheet7
  8. For Each A In .Range(.[D1], .[D65536].End(xlUp))
  9.     If Not Rng.Find(A, lookat:=xlWhole) Is Nothing Then
  10.        If cell Is Nothing Then Set cell = A Else Set cell = Union(cell, A)
  11.     End If
  12. Next
  13. End With

  14. Sheet8.Cells.Clear
  15. cell.EntireRow.Copy
  16. Sheet8.Range("A1").PasteSpecial Paste:=xlPasteValues

  17. End Sub
複製代碼
給其他大大參考:
懂得發問,答案就會在其中

今日の一秒は  明日にない
http://kimbalko-chi.blogspot.com
http://kimbalko.blogspot.com

TOP

本帖最後由 kimbal 於 2010-8-6 01:10 編輯

回復 6# ycchenzd

版本問題,07上運是沒問題的, 03的會出問題

請試試把
  1. Cell.EntireRow.Copy Sheet3.[A1] 
複製代碼
換成
  1. cell.EntireRow.Copy
  2. Sheet3.Range("A1").PasteSpecial Paste:=xlPasteValues
複製代碼
懂得發問,答案就會在其中

今日の一秒は  明日にない
http://kimbalko-chi.blogspot.com
http://kimbalko.blogspot.com

TOP

        靜思自在 : 每天無所事事,是人生的消費者,積極、有用才是人生的創造者。
返回列表 上一主題