Excel) (CellFormat 物件
代表儲存格格式的搜尋準則。
註解
使用 Application物件的FindFormat或ReplaceFormat屬性可傳回CellFormat物件。
使用CellFormat物件的Borders、Font或Interior屬性來定義儲存格格式的搜尋準則。
範例
下列範例會設定儲存格內部格式的搜尋準則。
Sub ChangeCellFormat()
' Set the interior of cell A1 to yellow.
Range("A1").Select
Selection.Interior.ColorIndex = 36
MsgBox "The cell format for cell A1 is a yellow interior."
' Set the CellFormat object to replace yellow with green.
With Application
.FindFormat.Interior.ColorIndex = 36
.ReplaceFormat.Interior.ColorIndex = 35
End With
' Find and replace cell A1's yellow interior with green.
ActiveCell.Replace What:="", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=True, _
ReplaceFormat:=True
MsgBox "The cell format for cell A1 is replaced with a green interior."
End Sub
方法
屬性
- AddIndent
- Application
- Borders
- Creator
- Font
- FormulaHidden
- HorizontalAlignment
- IndentLevel
- Interior
- Locked
- MergeCells
- NumberFormat
- NumberFormatLocal
- Orientation
- Parent
- ShrinkToFit
- VerticalAlignment
- WrapText
另請參閱
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應