![]() Option Explicit Private mOutline As Shape Private Const SelectedShapeName As String = "Selection Box" Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range) Dim SelectedShape As Shape Dim SelectedArea As Range On Error Resume Next For Each SelectedShape In Sh.Shapes If SelectedShape.Name = SelectedShapeName Then SelectedShape.Delete End If Next SelectedShape For Each SelectedArea In Selection.Areas Set mOutline = (msoShapeRectangle, SelectedArea.Left, SelectedArea.Top, SelectedArea.Width, SelectedArea.Height) .Fill.Visible = msoFalse. = RGB(255, 0, 0) .Line.Transparency = 0 mOutline. The below code adjustment will handle non-contiguous range selections, but ignores errors for entire rows/columns (which I think should be anyway). ![]() Your code doesn't accommodate either non-contiguous selections, nor too large selections without failing (i.e. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |