返回列表 上一主題 發帖

移動有顏色的列到其他sheet(小問題請教)

回復 13# jj369963
2003版本與其他新版的格式化條件公式,
並不會因為作用中儲存格位置改變而變動相對參照的部分公式,
所以,還找不出可個別判斷條件成立與否的函數或方法
退而求其次,置換格式化條件公式的參照列位
  1. Sub ex()
  2. Dim A As Range, f As FormatCondition, Rng(1 To 2) As Range
  3. With Sheet1
  4.    For Each A In .Range(.[A2], .[C2].End(xlDown).Offset(, -2)).SpecialCells(xlCellTypeAllFormatConditions)
  5.       For i = 1 To A.FormatConditions.Count
  6.          If Evaluate(Replace(A.FormatConditions(i).Formula1, 1, A.Row)) > 0 Then
  7.             If Rng(i) Is Nothing Then Set Rng(i) = Union(.[A1], A) Else Set Rng(i) = Union(Rng(i), A)
  8.             Exit For
  9.          End If
  10.       Next
  11.     Next
  12. End With
  13. sht = Array("無帳密", "無作答")
  14. For i = 1 To 2
  15.    Rng(i).EntireRow.Copy Sheets(sht(i - 1)).[A1]
  16.    Sheets(sht(i - 1)).UsedRange.FormatConditions.Delete '清除格式化條件
  17. Next
  18. End Sub
複製代碼
學海無涯_不恥下問

TOP

        靜思自在 : 慈悲沒有敵人,智慧不起煩惱。
返回列表 上一主題