0

Is it possible though to change all border colors without changing the border style? I have already tried selecting the line color and going through the cells with CTRL - but this does change the line styles and I have multiple styles I don't want to do from scratch.

  • Have you tried using the line-paint tool to draw the lines in place? – LPChip May 11 '17 at 11:08
  • Unless I misunderstood you - as I have written above - that is not what I want to do. I have a big table with multiple line styles (dashed ones, bold ones, thin ones etc.) and I want them to stay as they are but change their color (from black to gray). What i don't want to do is drawing all the borders from scratch – Joanna Glijer May 11 '17 at 12:06
  • You mean, you only want to change the background color of a cell? – LPChip May 11 '17 at 12:35
  • No, I want to change all the border colors - now all my borders (no matter what style - dashed, double, thick - are black. I want them to be gray but I want the styles to remain unchanged – Joanna Glijer May 11 '17 at 13:13
  • Ah. That is not possible though. The properties of a line are all connected, so changing the line color means changing the line style and thickness too. – LPChip May 11 '17 at 13:29
0

You can change the .colorindex property independently from other properties of the border objects, in VBA:

Sub bordercolor()
    With Selection.Borders
        .ColorIndex = 32
    End With
End Sub

This will only change the border color not the linestyle nor the width. Assign this macro to a key for convenience. 32 denotes a color index value, adjust to your liking. See this article for a description of the border collection if you want to change one specific border only (xlDiagonalDown, xlDiagonalUp, xlEdgeBottom, xlEdgeLeft, xlEdgeRight, xlEdgeTop, xlInsideHorizontal, or xlInsideVertical).

  • Contrary to a recent hint, this works as tested in Excel for Windows 2003. This might indicate that in more recent versions of Excel color and line style might not be independent of each other. – user1016274 Apr 14 '18 at 13:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.