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 / January 2006

Tip: Looking for answers? Try searching our database.

Border cells with less code?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
XP - 24 Jan 2006 16:20 GMT
I am using Office 2003 on Windows XP.

Drawing borders around cells seems so code intensive. Is there a shorter way
to accomplish the following (which simply boxes a range of cells)?

PLEASE NOTE: I tried "BorderAround," but this does not add the "inside
vertical" borders. This can be accomplished with one click of the toolbar
button, but in code...

With [A10:N10]
   .Borders(xlEdgeTop).Weight = xlThin
   .Borders(xlEdgeBottom).Weight = xlThin
   .Borders(xlEdgeLeft).Weight = xlThin
   .Borders(xlEdgeRight).Weight = xlThin
   .Borders(xlInsideVertical).Weight = xlThin
   .Borders(xlInsideHorizontal).Weight = xlThin
End With

Is there something like a "BoxAround" method? I tried BorderAround, but this
does not add the "inside vertical" borders.

Thanks much in advance for your input.
Philip - 24 Jan 2006 16:32 GMT
try something like this

Dim iBorder As XlBordersIndex

For iBorder = xlEdgeLeft To xlEdgeRight
   With [A10:N10]
       .Borders(iBorder).Weight = xlThin
   End With
Next

HTH

Philip

> I am using Office 2003 on Windows XP.
>
[quoted text clipped - 18 lines]
>
> Thanks much in advance for your input.
XP - 24 Jan 2006 18:01 GMT
Thanks!

> try something like this
>
[quoted text clipped - 32 lines]
> >
> > Thanks much in advance for your input.
Jim Thomlinson - 24 Jan 2006 16:51 GMT
Range("A10", "N10").Borders.Weight = xlThin

Signature

HTH...

Jim Thomlinson

> I am using Office 2003 on Windows XP.
>
[quoted text clipped - 18 lines]
>
> Thanks much in advance for your input.
XP - 24 Jan 2006 18:01 GMT
It was so simple, I couldn't figure it out... ;-)

Thanks Jim!

> Range("A10", "N10").Borders.Weight = xlThin
>
[quoted text clipped - 20 lines]
> >
> > Thanks much in advance for your input.
 
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.