Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / March 2008

Tip: Looking for answers? Try searching our database.

Border Problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gary''s Student - 13 Mar 2008 15:31 GMT
In a worksheet, I have borders around cells C5 and E8 and F4 and each cell in
D15:G19.

When I run:

Sub next_tryx()
Range("A1:G19").Borders(xlEdgeBottom).LineStyle = xlNone
End Sub

The only borders that get cleared are the ones on the last row (D19:G19).

Why not the others?
Signature

Gary''s Student - gsnu200773

JLGWhiz - 13 Mar 2008 15:43 GMT
Hey GS,  you probably have to use xlInsideHorizontal.

> In a worksheet, I have borders around cells C5 and E8 and F4 and each cell in
> D15:G19.
[quoted text clipped - 8 lines]
>
> Why not the others?
JLGWhiz - 13 Mar 2008 15:45 GMT
P.S.  extend your lower row by one to incorporate the last row of the range
you want to execute.

> In a worksheet, I have borders around cells C5 and E8 and F4 and each cell in
> D15:G19.
[quoted text clipped - 8 lines]
>
> Why not the others?
Rick Rothstein (MVP - VB) - 13 Mar 2008 15:49 GMT
You specified xlEdgeBottom for the the specific box surrounding A1:G19, not
all the edges for the various bordered areas inside. I think this should do
what you want...

Range("A1:G19").Borders.LineStyle = xlLineStyleNone

Rick

> In a worksheet, I have borders around cells C5 and E8 and F4 and each cell
> in
[quoted text clipped - 9 lines]
>
> Why not the others?
Stefi - 13 Mar 2008 15:52 GMT
I think because xlEdgeLeft, xlEdgeTop, etc. are independent properties and
borders of e.g. C5 are xlInsideVertical and xlInsideHorizontal relative to
Range("A1:G19").
You should use

    With Range("A1:G19")
       .Borders(xlEdgeLeft).LineStyle = xlNone
       .Borders(xlEdgeTop).LineStyle = xlNone
       .Borders(xlEdgeBottom).LineStyle = xlNone
       .Borders(xlEdgeRight).LineStyle = xlNone
       .Borders(xlInsideVertical).LineStyle = xlNone
       .Borders(xlInsideHorizontal).LineStyle = xlNone
   End With

if you want to remove all borders.

Regards,
Stefi

„Gary''s Student” ezt írta:

> In a worksheet, I have borders around cells C5 and E8 and F4 and each cell in
> D15:G19.
[quoted text clipped - 8 lines]
>
> Why not the others?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.