- 帖子
- 4901
- 主題
- 44
- 精華
- 24
- 積分
- 4916
- 點名
- 142
- 作業系統
- Windows 7
- 軟體版本
- Office 20xx
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台北
- 註冊時間
- 2010-4-30
- 最後登錄
- 2026-7-16
                
|
回復 13# jj369963
2003版本與其他新版的格式化條件公式,
並不會因為作用中儲存格位置改變而變動相對參照的部分公式,
所以,還找不出可個別判斷條件成立與否的函數或方法
退而求其次,置換格式化條件公式的參照列位- Sub ex()
- Dim A As Range, f As FormatCondition, Rng(1 To 2) As Range
- With Sheet1
- For Each A In .Range(.[A2], .[C2].End(xlDown).Offset(, -2)).SpecialCells(xlCellTypeAllFormatConditions)
- For i = 1 To A.FormatConditions.Count
- If Evaluate(Replace(A.FormatConditions(i).Formula1, 1, A.Row)) > 0 Then
- If Rng(i) Is Nothing Then Set Rng(i) = Union(.[A1], A) Else Set Rng(i) = Union(Rng(i), A)
- Exit For
- End If
- Next
- Next
- End With
- sht = Array("無帳密", "無作答")
- For i = 1 To 2
- Rng(i).EntireRow.Copy Sheets(sht(i - 1)).[A1]
- Sheets(sht(i - 1)).UsedRange.FormatConditions.Delete '清除格式化條件
- Next
- End Sub
複製代碼 |
|