BorderAround won't go away

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can someone explain why I still have a xlThick border around my range after I
run this procedure:

Sub brdrs()
Range("C3:G8").BorderAround Weight:=xlThick, _
ColorIndex:=xlColorIndexAutomatic
MsgBox "Check Border"
Range("C3:G8").BorderAround LineStyle:=-4142
Range("C3:G8").BorderAround LineStyle:=xlLineStyleNone
Range("C3:G8").BorderAround LineStyle:=xlNone
End Sub
 
The VBA help instructions are misleading. The correct syntax should be

Range("C3:G8").Borders.LineStyle = xlNone
 
It's counterintuitive, but you have to remove them individually:

Sub brdrs()
With Range("C3:G8")
.BorderAround Weight:=xlThick, ColorIndex:=xlColorIndexAutomatic
MsgBox "Check Border"
.Borders(xlEdgeLeft).LineStyle = xlNone
.Borders(xlEdgeTop).LineStyle = xlNone
.Borders(xlEdgeBottom).LineStyle = xlNone
.Borders(xlEdgeRight).LineStyle = xlNone
End With
End Sub
_____________________________________________________________________
 
Sub brdrs()
Range("C3:G8").BorderAround Weight:=xlThick, _
ColorIndex:=xlColorIndexAutomatic
MsgBox "Check Border"
Range("C3:G8").Borders.LineStyle = xlNone
End Sub
 
Thanks for the responses, I guess I should have made the post as a comment.
The VBA help instructions imply that you can use the syntax that I originally
posted, although I had not use that method before. When I could not get it
to work, I thought maybe there was a glitch in the software. Then I realized
that it was just another poorly written remark in the VBA help files. That's
why I did the second posting.

Thanks again for caring. JLG
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top