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

Having recently got in a twizz regarding xlPasteColumnWidths vs
xlColumnWidths, I have now come across something similar. Old macros
that I create some time ago use the following :

Selection.Borders(xlLeft)

As I'm trying to understand what is going on, I looked in VBA Help,
only to find refrences to the relevant following XlBordersIndex
constant, xlEdgeLeft.

Just to put things in their place, can anyone advise whether this
matters and what is the correct Index to use with the Border object.

Cheers,

Mark
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Borders(xlLeft)

Mark,

xlLeft = -4131 and xlEdgeLeft = 7, so for borders you want to use
xlEdgeLeft.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Mark Worthington" wrote in message
om...
Having recently got in a twizz regarding xlPasteColumnWidths vs
xlColumnWidths, I have now come across something similar. Old

macros
that I create some time ago use the following :

Selection.Borders(xlLeft)

As I'm trying to understand what is going on, I looked in VBA

Help,
only to find refrences to the relevant following XlBordersIndex
constant, xlEdgeLeft.

Just to put things in their place, can anyone advise whether

this
matters and what is the correct Index to use with the Border

object.

Cheers,

Mark



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Borders(xlLeft)

Chip,

Advice taken, but I don't understand this : I select any number of
cells, then :

My old code using xlLeft :

With Selection.Borders(xlLeft)
.LineStyle = xlContinuous
.Weight = xlMedium
.Color = RGB(0, 0, 0)
End With

will border each and every selected cell.

New code using xlEdgeLeft :

With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlMedium
.Color = RGB(0, 0, 0)
End With

Will border only the left edge (obviously).

Is the xlLeft something from by-gone days, say Excel 97, because I can
find no references to it in Help?

Cheers,

Mark


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Borders(xlLeft)

Mark,

The two snippets of code seem to do exactly the same thing. I
suspect that xlLeft is left over from previous versions of Excel,
having been replaced with other constants with the same value,
such as xlSummaryOnLeft, xlLegendPositionLeft, and xlAlignLeft.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Mark Worthington" wrote in message
...
Chip,

Advice taken, but I don't understand this : I select any number

of
cells, then :

My old code using xlLeft :

With Selection.Borders(xlLeft)
.LineStyle = xlContinuous
.Weight = xlMedium
.Color = RGB(0, 0, 0)
End With

will border each and every selected cell.

New code using xlEdgeLeft :

With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlMedium
.Color = RGB(0, 0, 0)
End With

Will border only the left edge (obviously).

Is the xlLeft something from by-gone days, say Excel 97,

because I can
find no references to it in Help?

Cheers,

Mark


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Borders(xlLeft)

Chip,

Not quite.

If you select 9 cells, say a 3x3, then Borders(XlLeft) will not only
border the leftmost 3 cells, but also the other 2 columns of cells, too.

Borders(xlEdgeLeft) will ONLY border the leftmost 3 cells. To do the
same job as above, you need to also apply Borders(xlInsideVertical) to
the 3x3 selection.

This raises the general question with Excel : is it wise to carry on
using what appears to be an undocumented constant which does the job of
2 "latest" ones .... or apply the new constants as and when they become
current?

It's like vbCrLf, vbCr, vbLf, vbNewLine ... I use the last one as it
makes more sense to me ... I suppose there's no absolute right or wrong.

Regards,

Mark

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


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
Borders Larry L Excel Discussion (Misc queries) 2 August 11th 09 05:45 PM
Borders Derek Koehler Excel Discussion (Misc queries) 1 March 12th 09 02:19 PM
borders wdm0970 Excel Discussion (Misc queries) 1 September 26th 06 09:31 PM
borders Brush Prairie Excel Discussion (Misc queries) 0 August 23rd 05 02:57 AM
Help with borders Ed[_10_] Excel Programming 0 July 23rd 03 08:07 PM


All times are GMT +1. The time now is 12:41 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"