【VBA】選択したセルに赤枠を配置するマクロ

何かと便利かなと

 

'選択したセルに赤枠を配置
Sub redFlame()
 
 Dim Bar As Shape
 Dim cell As String
 
 'アクティブセルを取得
 cell = ActiveCell.address
 
 If cell <> "" Then
  '図形の種類、位置情報設定
  Set Bar = ActiveSheet.Shapes.AddShape _
    (msoShapeRectangle, _
    Range(cell).Left, _
    Range(cell).Top, _
    110, _
    25)
  
  '枠内の書式設定
  With Bar.Fill
   .Visible = msoFalse
  End With
  
  '枠の書式設定
  With Bar.Line
   .Visible = msoTrue
   .ForeColor.RGB = RGB(255, 0, 0)
   .Transparency = 0
   .Weight = 3
  End With
 End If
End Sub

 

サイズは適当

 

以上