BorderAround method failure

  • Thread starter Thread starter johnhildreth
  • Start date Start date
J

johnhildreth

The following code fails at the BorderAround line. What am I missing?

With Range(Cells(6, 1), Cells(7, 2))
.BorderAround Weight:=xlMedium
.Borders.Item(xlInsideHorizontal).LineStyle = xlContinuous
.Borders.Item(xlInsideHorizontal).Weight = xlThin
End With

I know this is simple, but from what I read it should work.

Thanks,
John
 
Hi John,

Your code works fine for me. Would fail though if the activesheet is not a
worksheet, or if a worksheet chart is selected. Any protection?

Regards,
Peter T
 
The sheet on which I want this to happen is active and not protected.

I get a "BorderAround method of Range class failed" error.

I can use 4 lines to set the border on the edges, but I want to
understand this. I'm running xl2003 in XP, if that matters.

Thanks,
John
 
Afraid I'm out of ideas, as I said it worked for me.

If you try something else before BorderAround does it work

With Range(Cells(6, 1), Cells(7, 2))
.Interior.ColorIndex = 6
.BorderAround Weight:=xlMedium

Regards,
Peter T
 
Back
Top