-
Excel VBA borders
This may not be the right forum, but I am usine VBA in Excel(Yuck), I have to group 3 cells together in the same column. I don't want the interior lines to show inside but I do want a border around them. I can't merge,this deletes data, I haven't found the right Border properties to use.
Thanks for help
-
Re: Excel VBA borders
Thread moved to Office Development/VBA forum
-
Re: Excel VBA borders
In Object Browser, search for "xlBordersIndex" for all border index values
Try to record a macro you will learn from that.
However, this is the shortest modified code that will do the task:
Code:
Dim b As Integer
With Sheet1.Range("C3:C5")
For b = xlDiagonalDown To xlInsideHorizontal '-- 5 To 12
Select Case b
'Case xlEdgeLeft, xlEdgeTop, xlEdgeBottom, xlEdgeRight '-- 7, 8, 9, 10
Case xlEdgeLeft To xlEdgeRight '-- 7 to 10
.Borders(b).LineStyle = xlContinuous
.Borders(b).Weight = xlThin
Case Else
.Borders(b).LineStyle = xlNone
End Select
Next
End With