ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   BorderAround method failure (https://www.excelbanter.com/excel-programming/348408-borderaround-method-failure.html)

[email protected]

BorderAround method failure
 
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


Peter T

BorderAround method failure
 
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

wrote in message
oups.com...
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




[email protected]

BorderAround method failure
 
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


[email protected]

BorderAround method failure
 
Got it! It was being protected by errant code. Thanks.

John


Peter T

BorderAround method failure
 
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


wrote in message
oups.com...
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





All times are GMT +1. The time now is 12:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com