共用方式為


Excel) (CellFormat.Borders 屬性

會傳回或設定 Borders 集合,代表以儲存格框線格式為基礎的搜尋準則。

語法

運算式邊界

表達 代表 CellFormat 物件的 變數。

範例

這個範例會設定搜尋準則以識別下邊緣具有連續粗框線的儲存格、建立符合此條件的儲存格、尋找這個儲存格,並且通知使用者。

注意事項

在此範例中會使用框線的預設色彩;因此,色彩索引不會變更。

Sub SearchCellFormat() 
 
 ' Set the search criteria for the border of the cell format. 
 With Application.FindFormat.Borders(xlEdgeBottom) 
 .LineStyle = xlContinuous 
 .Weight = xlThick 
 End With 
 
 ' Create a continuous thick bottom-edge border for cell A5. 
 Range("A5").Select 
 With Selection.Borders(xlEdgeBottom) 
 .LineStyle = xlContinuous 
 .Weight = xlThick 
 End With 
 Range("A1").Select 
 MsgBox "Cell A5 has a continuous thick bottom-edge border" 
 
 ' 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 支援與意見反應