[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 552
  • Last Modified:

How to change Excel selection style

Hi all,

I have to highlight a (multi)range in excel. I like it best, if I only have to select the range, but I don't like the normal selection mode. I am looking for an eyecatcher, like the border if you cut a cell. Is there a way to select a range and change the selection-border, without changing the content of the clipboard?

0
Datenkultur
Asked:
Datenkultur
  • 2
1 Solution
 
patrickabCommented:
>...I don't like the normal selection mode.

How are you selecting the range? Is it with a mouse or using F5?

Patrick
0
 
ghoshsaikat83Commented:
With my little knowledge in excel, I don't think it is possible.

Joydip
0
 
patrickabCommented:
Datenkultur,

The code below is in the attached file. It places a border around selected cells on Sheet1 only. To get rid of all the borders press CTRL+A. It's a horrible solution and I would personally never use it.

To get a proper solution you would need to rewrite the code for the cell cursor - and that is not possible as the code is not accessible.

I am not at all sure why you want to change something that everyone else finds acceptable?

Patrick
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlDashDotDot
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlDashDotDot
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlDashDotDot
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlDashDotDot
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    Selection.Borders(xlInsideVertical).LineStyle = xlNone
    Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
End Sub

Open in new window

selection-border-01.xls
0
 
DatenkulturAuthor Commented:
Thanks for your code Patrickab, but I will not use the cellformats, because I have to store the old formats then. At the moment I try to use shapes, but they don't have events, so I have to use Charts for the events. I combine them, but there are some other problems now.

I think the question to change the select-mode has its answer in: Its not possible.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now