Share via


CellFormat.Borders プロパティ (Excel)

セルの罫線の形式に基づいて検索条件を表す 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 のサポートおよびフィードバックを参照してください。