locked
VB to change the colour of a double underline border RRS feed

  • Question

  • HI

    Looking to hide a double underline border from view- so was going to colour it the same as the background colour (one of the greys) that I'm using- any idea how to do this?

    Thanks

    David

    Thursday, February 4, 2016 8:32 PM

Answers

  • Thanks- but in this case was easier to just remove the borders and put them back when needed.

    I used...

     
     ' to hide borders
         
    Range("D14,e19,e23").Borders.LineStyle = xlNone
        
        ' to put them back
         Range("D14,e19,e23").Select
        With Selection.Borders(xlEdgeTop)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlThin
        End With
        With Selection.Borders(xlEdgeBottom)
            .LineStyle = xlDouble
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlThick
        End With

    • Marked as answer by David_1234 Friday, February 5, 2016 1:27 PM
    Friday, February 5, 2016 1:27 PM

All replies

  • Hi David,

    For this scenario, you could check Color property of specific Border object.

    # Borders.Item Property

    https://msdn.microsoft.com/EN-US/library/office/ff194532.aspx

    For VB:

    # Borders.Item property

    https://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.borders.item.aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1

    Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, February 5, 2016 7:22 AM
  • Thanks- but in this case was easier to just remove the borders and put them back when needed.

    I used...

     
     ' to hide borders
         
    Range("D14,e19,e23").Borders.LineStyle = xlNone
        
        ' to put them back
         Range("D14,e19,e23").Select
        With Selection.Borders(xlEdgeTop)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlThin
        End With
        With Selection.Borders(xlEdgeBottom)
            .LineStyle = xlDouble
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlThick
        End With

    • Marked as answer by David_1234 Friday, February 5, 2016 1:27 PM
    Friday, February 5, 2016 1:27 PM