Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
XP XP is offline
external usenet poster
 
Posts: 389
Default Border cells with less code?

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 156
Default Border cells with less code?

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

"XP" wrote:

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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 486
Default Border cells with less code?

Range("A10", "N10").Borders.Weight = xlThin

--
HTH...

Jim Thomlinson


"XP" wrote:

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.

  #4   Report Post  
Posted to microsoft.public.excel.programming
XP XP is offline
external usenet poster
 
Posts: 389
Default Border cells with less code?

It was so simple, I couldn't figure it out... ;-)

Thanks Jim!

"Jim Thomlinson" wrote:

Range("A10", "N10").Borders.Weight = xlThin

--
HTH...

Jim Thomlinson


"XP" wrote:

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.

  #5   Report Post  
Posted to microsoft.public.excel.programming
XP XP is offline
external usenet poster
 
Posts: 389
Default Border cells with less code?

Thanks!

"Philip" wrote:

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

"XP" wrote:

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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Border Cells Steved Excel Worksheet Functions 4 July 29th 09 08:14 PM
I want to select only cells with a border dadouza Excel Discussion (Misc queries) 1 June 29th 08 11:33 PM
code to fill in missing border lines Jack Sons Excel Discussion (Misc queries) 3 November 3rd 05 10:06 PM
Changing the border of one cell s/n change the border of adjacent gjanssenmn Excel Discussion (Misc queries) 2 October 5th 05 08:35 PM
cells not printing within border Pookie Excel Worksheet Functions 0 March 7th 05 06:37 PM


All times are GMT +1. The time now is 11:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"