Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 441
Default Remove all borders from a range

I am using Office 2003 on Windows XP.

I recorded the code to remove ALL borders from a range and got the following:

Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone

Is there a simpler code to just remove all the borders in a range of cells?
If so, could you please post example code?
Thanks much in advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Remove all borders from a range

Sub test()
Dim rng As Range

Set rng = ActiveSheet.Range("A1:B10")

rng.Borders.LineStyle = xlNone
End Sub
--
HTH...

Jim Thomlinson


"quartz" wrote:

I am using Office 2003 on Windows XP.

I recorded the code to remove ALL borders from a range and got the following:

Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone

Is there a simpler code to just remove all the borders in a range of cells?
If so, could you please post example code?
Thanks much in advance.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 441
Default Remove all borders from a range

That would do it. Thanks Jim.

"Jim Thomlinson" wrote:

Sub test()
Dim rng As Range

Set rng = ActiveSheet.Range("A1:B10")

rng.Borders.LineStyle = xlNone
End Sub
--
HTH...

Jim Thomlinson


"quartz" wrote:

I am using Office 2003 on Windows XP.

I recorded the code to remove ALL borders from a range and got the following:

Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone

Is there a simpler code to just remove all the borders in a range of cells?
If so, could you please post example code?
Thanks much in advance.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Remove all borders from a range

Yet one more instance where something so easy is made so complex when
recorded. At least you are savy enough to recognize garbage when you see it
and know that there just has to be a better way.
--
HTH...

Jim Thomlinson


"quartz" wrote:

That would do it. Thanks Jim.

"Jim Thomlinson" wrote:

Sub test()
Dim rng As Range

Set rng = ActiveSheet.Range("A1:B10")

rng.Borders.LineStyle = xlNone
End Sub
--
HTH...

Jim Thomlinson


"quartz" wrote:

I am using Office 2003 on Windows XP.

I recorded the code to remove ALL borders from a range and got the following:

Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone

Is there a simpler code to just remove all the borders in a range of cells?
If so, could you please post example code?
Thanks much in advance.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 129
Default Remove all borders from a range

Hi,

in excel 2000, Borders.LineStyle doesn't change diagonal lines and the
borders of adjacent cells.
I suppose that if you want to delete them, something like the code you
wrote is needed. this is an example of looping:

Sub ClearBorders()
Dim b As Variant
For Each b In Array(xlDiagonalDown, xlDiagonalUp, _
xlEdgeLeft, xlEdgeTop, xlEdgeBottom, xlEdgeRight, _
xlInsideVertical, xlInsideHorizontal)
Selection.Borders(b).LineStyle = xlNone
Next
End Sub

--

HTH,

okaizawa

quartz wrote:
I am using Office 2003 on Windows XP.

I recorded the code to remove ALL borders from a range and got the following:

Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone

Is there a simpler code to just remove all the borders in a range of cells?
If so, could you please post example code?
Thanks much in advance.

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
Find Range Borders (Cell Addresses) In VBA FARAZ QURESHI Excel Discussion (Misc queries) 8 May 16th 09 06:16 AM
Borders for range Neil Pearce Excel Discussion (Misc queries) 0 April 8th 08 11:58 AM
Sorting a range loses formatted borders Jim Cone Excel Discussion (Misc queries) 2 February 25th 08 07:58 PM
how do you remove borders DD Excel Discussion (Misc queries) 4 February 23rd 07 06:37 AM
Borders nor underline commands remove an unusual underline. ?? VideoFreak Excel Discussion (Misc queries) 4 February 11th 06 08:17 PM


All times are GMT +1. The time now is 12:18 AM.

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

About Us

"It's about Microsoft Excel"