Excel) (CellFormat.Interior 屬性

傳回 Interior 物件,允許使用者根據儲存格的內部格式設定或傳回搜尋準則。

語法

運算式。內飾

運算式 代表 CellFormat 物件的變數。

範例

本範例設定搜尋準則,以識別內部為黃色的儲存格,然後建立具有此條件的儲存格,找出這個儲存格,並且通知使用者。

Sub SearchCellFormat() 
 
 ' Set the search criteria for the interior of the cell format. 
 With Application.FindFormat.Interior 
 .ColorIndex = 6 
 .Pattern = xlSolid 
 .PatternColorIndex = xlAutomatic 
 End With 
 
 ' Create a yellow interior for cell A5. 
 Range("A5").Select 
 With Selection.Interior 
 .ColorIndex = 6 
 .Pattern = xlSolid 
 .PatternColorIndex = xlAutomatic 
 End With 
 Range("A1").Select 
 MsgBox "Cell A5 has a yellow interior." 
 
 ' Find the cells based on the search criteria. 
 Cells.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _ 
 xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _ 
 , SearchFormat:=True).Activate 
 MsgBox "Microsoft Excel has found this cell matching the search criteria." 
 
End Sub

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。