Hello,
In my worksheet i have a range of data form column B to AG.
Within these columns i hide the colums where is no data in row 5.
And here comes my problem, when i want a xlmedium border around this new range it doesn't do what i want.
Al the edge's are xlmedium, except the edge on the far right (last column), this one is always xlthin.
How is this possible, when i selected the range within the code.
hope someone can help me.
In my worksheet i have a range of data form column B to AG.
Within these columns i hide the colums where is no data in row 5.
And here comes my problem, when i want a xlmedium border around this new range it doesn't do what i want.
Al the edge's are xlmedium, except the edge on the far right (last column), this one is always xlthin.
How is this possible, when i selected the range within the code.
hope someone can help me.
Code:
Sub borders()
Dim myBorders() As Variant, myBorders1() As Variant, myBorders2() As Variant, item As Variant
myBorders = Array(xlEdgeLeft, xlEdgeTop, xlEdgeBottom, xlEdgeRight)
myBorders1 = Array(xlInsideVertical, xlInsideHorizontal)
myBorders2 = Array(xlDiagonalDown, xlDiagonalUp)
Application.ScreenUpdating = False
sheets(Array("Jan", "Feb", "Mrt", "Apr", "Mei", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", _
"Dec")).Select
Union(Range(Cells(2, 2).End(xlToRight), Cells(19, 3)), Range(Cells(21, 3).End(xlToRight), Cells(38, 3))).Select
For Each item In myBorders
With Selection.Borders(item)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.Weight = xlMedium
End With
Next item
For Each item In myBorders1
With Selection.Borders(item)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.Weight = xlThin
End With
Next item
For Each item In myBorders2
With Selection.Borders(item)
.LineStyle = xlNone
End With
Next item
Application.ScreenUpdating = True
End Sub