+ Reply to Thread
Results 1 to 4 of 4

BorderAround behaving strangely

Hybrid View

  1. #1
    Registered User
    Join Date
    07-20-2014
    Location
    US
    MS-Off Ver
    2010
    Posts
    27

    BorderAround behaving strangely

    I was experimenting on adding borders around some named ranges, when I encountered a bit of an oddity

    I know that selecting and color filling a named range works, but BorderAround is behaving unexpectedly.

    When I process BorderAround, the results are that some border lines of the range area are either missing or the lines are intermittently spaced between cells, resulting in a dashed line that's usually on one or two sides of the named range. I also noticed that if I change the color value, some of the side lines of the borderaround area may have a different colors?

    Interestingly enough, this behavior is consistent for each named range processed even after closing and reopening excel.

    Private Sub CommandAgrmnt_Click()
    Dim Agrmnt          As String
    
    Agrmnt = Me.ComboBox.Value
    
    'Range(Agrmnt).Select
    
    Worksheets("Sheet1").Range(Agrmnt).BorderAround _
    LineStyle:=xlContinuous, Weight:=xlThick, ColorIndex:=3
    
    'Worksheets("Sheet1").Range(Agrmnt).Interior.ColorIndex = 3
    
    End Sub

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    8,031

    Re: BorderAround behaving strangely

    I tried that code in a mocked up workbook and it works fine. Puts thick red lines around whichever named range is selected in a combobox. The line is solid, no bits missing...
    So unable to replicate your issue, perhaps you could post a desensitized version of your workbook so we could see it happening there?

    BSB

  3. #3
    Registered User
    Join Date
    07-20-2014
    Location
    US
    MS-Off Ver
    2010
    Posts
    27

    Re: BorderAround behaving strangely

    I rebuild it from scratch thinking that perhaps there was a possible conflict, but I'm still getting odd results. I did notice one good thing, If I remove the background borders prior to processing, it will work. However the intent is to over-post / replace portions on the the background borders with a named ranges. The background serves as a reference.
    Attached Files Attached Files
    Last edited by Purgatorium; 05-10-2016 at 08:39 PM.

  4. #4
    Registered User
    Join Date
    07-20-2014
    Location
    US
    MS-Off Ver
    2010
    Posts
    27

    Re: BorderAround behaving strangely

    I did find a work around using the macro routine, albeit it is longer than "BorderAround", it does work.

    Private Sub CommandZone_Click()
    Dim Zone          As String
    
    Zone = Me.ComboBox.Value
    
        Range(Zone).Select
        Selection.Borders(xlDiagonalDown).LineStyle = xlNone
        Selection.Borders(xlDiagonalUp).LineStyle = xlNone
        With Selection.Borders(xlEdgeLeft)
            .LineStyle = xlContinuous
            .Color = -16777024
            .TintAndShade = 0
            .Weight = xlThick
        End With
        With Selection.Borders(xlEdgeTop)
            .LineStyle = xlContinuous
            .Color = -16777024
            .TintAndShade = 0
            .Weight = xlThick
        End With
        With Selection.Borders(xlEdgeBottom)
            .LineStyle = xlContinuous
            .Color = -16777024
            .TintAndShade = 0
            .Weight = xlThick
        End With
        With Selection.Borders(xlEdgeRight)
            .LineStyle = xlContinuous
            .Color = -16777024
            .TintAndShade = 0
            .Weight = xlThick
        End With
        Range("A1").Select
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] BorderAround for Range (lastRow)
    By Quasis in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-06-2015, 03:01 PM
  2. [SOLVED] If # > 0 in $D4 then $A4 thru $D4 BorderAround
    By klotzy in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-27-2015, 10:43 AM
  3. [SOLVED] Lookup behaving strangely
    By markainsworth in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-29-2013, 10:09 AM
  4. IF formula behaving strangely in certain cells
    By gramomster in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-09-2013, 12:15 PM
  5. Excel is behaving strangely for no apparent reason.
    By canyondude in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 01-09-2006, 08:10 PM
  6. Excel 2003 behaving strangely
    By pinkshiro in forum Excel General
    Replies: 3
    Last Post: 08-12-2005, 08:05 AM
  7. Conditional formatting behaving strangely
    By Danny J in forum Excel General
    Replies: 10
    Last Post: 01-12-2005, 08:06 PM

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