返回列表 上一主題 發帖

多個工作表 比對 後刪除列

回復 1# pinklee
  1. Sub ex()
  2. Dim Sh As Worksheet
  3. For Each Sh In Sheets
  4.   If Sh.Name <> "準則" Then
  5.   With Sh
  6.     .Range(.[C1], .[A65536].End(xlUp).Offset(, 2)).FormulaR1C1 = "=1/ISERROR(MATCH(RC[-2],準則!C[-2],0))"
  7.      a = .Range(.[C1], .[A65536].End(xlUp).Offset(, 2)).Address(, , , 1)
  8.     If Evaluate("SumProduct(IsError(" & a & ") * 1)") > 0 Then
  9.     .Range(.[C1], .[A65536].End(xlUp).Offset(, 2)).SpecialCells(xlCellTypeFormulas, 16).EntireRow.Delete
  10.     End If
  11.     .Columns("C").Clear
  12.   End With
  13. End If
  14. Next
  15. End Sub
複製代碼
學海無涯_不恥下問

TOP

        靜思自在 : 閒人無樂趣,忙人無是非。
返回列表 上一主題