+ Reply to Thread
Results 1 to 4 of 4

Drawing a border around Cell Ranges

Hybrid View

  1. #1
    Registered User
    Join Date
    02-26-2009
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    2

    Drawing a border around Cell Ranges

    Hi

    I want to draw a border around a Range of Cells in excel sheet using VBA. I want the border which comes when we select a chart in excel. i.e. a blue colored border with which we can use any four corners to move that border by one cell.

    I need to do this using VBA.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,482

    Re: Drawing a border around Cell Ranges

    That blue border is the one in xl2007?

    That type of bordering is for objects rather than cells. Whilst you maybe able to use a shape to display the border you will not be able to code against it.

    If you assign a macro it will run before you can resize the shape.
    If you right click the shape to resize it will not run the macro.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    02-26-2009
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Drawing a border around Cell Ranges

    Is it possible to create a custom object which contains a cell reference? That border is the one that is associated with charts or the one that appears when we give a cell reference in formulas.

    The border is a blue colored one which is expandable in all directions. In case of charts there are multiple such borders, blue one is the one that indicates the actual data set of the chart. You can see this by creating a chart and just selecting it.

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,482

    Re: Drawing a border around Cell Ranges

    I know the border you mean I was just confirming as your profile says xl2003 and you made no mention of which particular version you are looking at.

    As I said, there is no actual border object.
    You could mimic it by using an empty chart object and a class module to capture the resize event.

    In the attached you need to press the Initialize button, this will allow you to then select the chart. It's there with it's border in the unselected state over the red cells.
    If you resize the chart with the ALT key pressed, in order to make the chart snap to row/column boundaries. It will colour the cells within the border red.

    Without the ALT key the colour may have a gap either just inside or outside the border.

    Not sure how much use this is though.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1