Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Borders Object


Just a quick question about formatting borders. I'm working on cleaning
up some old code created by other programmers.
This is what they had:
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
..LineStyle = xlContinuous
..Weight = xlThin
..ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
..LineStyle = xlContinuous
..Weight = xlThin
..ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
..LineStyle = xlContinuous
..Weight = xlThin
..ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
..LineStyle = xlContinuous
..Weight = xlThin
..ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
..LineStyle = xlContinuous
..Weight = xlThin
..ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
..LineStyle = xlContinuous
..Weight = xlThin
..ColorIndex = xlAutomatic
End With
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
..LineStyle = xlContinuous
..Weight = xlMedium
..ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
..LineStyle = xlContinuous
..Weight = xlMedium
..ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
..LineStyle = xlContinuous
..Weight = xlMedium
..ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
..LineStyle = xlContinuous
..Weight = xlMedium
..ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
..LineStyle = xlContinuous
..Weight = xlThin
..ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
..LineStyle = xlContinuous
..Weight = xlThin
..ColorIndex = xlAutomatic
End With

This is what I've changed it to:
Selection.Borders(xlInsideVertical).LineStyle = xlContinuous
Selection.Borders(xlInsideVertical).Weight = xlThin
Selection.Borders(xlInsideHorizontal).LineStyle = xlContinuous
Selection.Borders(xlInsideHorizontal).Weight = xlThin
Selection.Borders(xlEdgeLeft).LineStyle = xlContinuous
Selection.Borders(xlEdgeLeft).Weight = xlMedium
Selection.Borders(xlEdgeTop).LineStyle = xlContinuous
Selection.Borders(xlEdgeTop).Weight = xlMedium
Selection.Borders(xlEdgeBottom).LineStyle = xlContinuous
Selection.Borders(xlEdgeBottom).Weight = xlMedium
Selection.Borders(xlEdgeRight).LineStyle = xlContinuous
Selection.Borders(xlEdgeRight).Weight = xlMedium

What I'm wondering, is if I need the xlContinuous portion of LineStyle?
I changed my code to this:
Selection.Borders(xlInsideVertical).Weight = xlThin
Selection.Borders(xlInsideHorizontal).Weight = xlThin
Selection.Borders(xlEdgeLeft).Weight = xlMedium
Selection.Borders(xlEdgeTop).Weight = xlMedium
Selection.Borders(xlEdgeBottom).Weight = xlMedium
Selection.Borders(xlEdgeRight).Weight = xlMedium

And it seems to do the same thing. I don't, however, know if this will
cause any issues in the future, or if it is a very good way to handle
this? Any input is greatly appreciated!!


Thanks,

DejaVu


--
DejaVu
------------------------------------------------------------------------
DejaVu's Profile: http://www.excelforum.com/member.php...o&userid=22629
View this thread: http://www.excelforum.com/showthread...hreadid=383162

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Borders Object


Just keeping this thread alive. Any input on this?


--
DejaVu
------------------------------------------------------------------------
DejaVu's Profile: http://www.excelforum.com/member.php...o&userid=22629
View this thread: http://www.excelforum.com/showthread...hreadid=383162

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Borders Object

What I'm wondering, is if I need the xlContinuous portion of LineStyle?

Unless you don't want to change any previous linestyle that might have been
set, then yes.

In passing, as all your outside edges appear to have the same formats, have
a look at Bordersaround in help, eg

Selection.BorderAround Weight:=xlThick ' and include the other properties

Also, could use With ... End With

Regards,
Peter T



"DejaVu" wrote in
message ...

Just a quick question about formatting borders. I'm working on cleaning
up some old code created by other programmers.
This is what they had:
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
LineStyle = xlContinuous
Weight = xlThin
ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
LineStyle = xlContinuous
Weight = xlThin
ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
LineStyle = xlContinuous
Weight = xlThin
ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
LineStyle = xlContinuous
Weight = xlThin
ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
LineStyle = xlContinuous
Weight = xlThin
ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
LineStyle = xlContinuous
Weight = xlThin
ColorIndex = xlAutomatic
End With
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
LineStyle = xlContinuous
Weight = xlMedium
ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
LineStyle = xlContinuous
Weight = xlMedium
ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
LineStyle = xlContinuous
Weight = xlMedium
ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
LineStyle = xlContinuous
Weight = xlMedium
ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
LineStyle = xlContinuous
Weight = xlThin
ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
LineStyle = xlContinuous
Weight = xlThin
ColorIndex = xlAutomatic
End With

This is what I've changed it to:
Selection.Borders(xlInsideVertical).LineStyle = xlContinuous
Selection.Borders(xlInsideVertical).Weight = xlThin
Selection.Borders(xlInsideHorizontal).LineStyle = xlContinuous
Selection.Borders(xlInsideHorizontal).Weight = xlThin
Selection.Borders(xlEdgeLeft).LineStyle = xlContinuous
Selection.Borders(xlEdgeLeft).Weight = xlMedium
Selection.Borders(xlEdgeTop).LineStyle = xlContinuous
Selection.Borders(xlEdgeTop).Weight = xlMedium
Selection.Borders(xlEdgeBottom).LineStyle = xlContinuous
Selection.Borders(xlEdgeBottom).Weight = xlMedium
Selection.Borders(xlEdgeRight).LineStyle = xlContinuous
Selection.Borders(xlEdgeRight).Weight = xlMedium

What I'm wondering, is if I need the xlContinuous portion of LineStyle?
I changed my code to this:
Selection.Borders(xlInsideVertical).Weight = xlThin
Selection.Borders(xlInsideHorizontal).Weight = xlThin
Selection.Borders(xlEdgeLeft).Weight = xlMedium
Selection.Borders(xlEdgeTop).Weight = xlMedium
Selection.Borders(xlEdgeBottom).Weight = xlMedium
Selection.Borders(xlEdgeRight).Weight = xlMedium

And it seems to do the same thing. I don't, however, know if this will
cause any issues in the future, or if it is a very good way to handle
this? Any input is greatly appreciated!!


Thanks,

DejaVu


--
DejaVu
------------------------------------------------------------------------
DejaVu's Profile:

http://www.excelforum.com/member.php...o&userid=22629
View this thread: http://www.excelforum.com/showthread...hreadid=383162



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Borders Object


Thanks Peter T...

Very helpful in cleaning up old code!

--
DejaV
-----------------------------------------------------------------------
DejaVu's Profile: http://www.excelforum.com/member.php...fo&userid=2262
View this thread: http://www.excelforum.com/showthread.php?threadid=38316

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
2 Label Options - Forms Object vs Control Box Object Awrex Excel Discussion (Misc queries) 3 July 17th 09 07:10 PM
Excel object in word document; some cell borders are too dark michalaw Excel Discussion (Misc queries) 0 July 11th 08 07:34 PM
Object Variable Not Set Error on Selection object Jean Excel Worksheet Functions 3 July 24th 06 06:45 PM
Confusion about how the Window object fits into the Excel object model Josh Sale Excel Programming 11 April 15th 05 06:08 PM
How to Add an Object to the New Object List in windows 2000 Bubu Excel Programming 5 June 3rd 04 12:42 PM


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

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"