onarollcanada
New Member
- Joined
- Sep 24, 2012
- Messages
- 11
Hello,
I am using the code posted below to remove the center border from an already selected group of cells. It works perfectly, but it then also removes the white background color in the selected cells. I have tried several different codes that I found online (ie cell.interior.color =, .Interior.ColorIndex =) to add to my current code with no luck. I can't define any specific area or range since the groupings can appear anywhere on my worksheet. Any suggestions?
Thanks
--------------------------------------------------------------------------------------------------------------------------
Sub CutMidBorder()
'
' CutMidBorder Macro
'
'
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
End Sub
I am using the code posted below to remove the center border from an already selected group of cells. It works perfectly, but it then also removes the white background color in the selected cells. I have tried several different codes that I found online (ie cell.interior.color =, .Interior.ColorIndex =) to add to my current code with no luck. I can't define any specific area or range since the groupings can appear anywhere on my worksheet. Any suggestions?
Thanks
--------------------------------------------------------------------------------------------------------------------------
Sub CutMidBorder()
'
' CutMidBorder Macro
'
'
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
End Sub