Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 171
Default "Linestyle" in Macro

I have a Macro that identifies some sets of Rows, and based on the result,
highlights them with a background color. Because some of the sets are
contiguous, I want to separate them with a thick line. This code works after
a fashion:

Selection.End(xlToLeft).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(("A" & NewStartRow - varOffset), ("S" &
NewStartRow - 1)).Select
With Selection.Interior
.ColorIndex = 40
.Pattern = xlSolid
End With
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone

However if there are two contiguous sets, the Line under the first set gets
overwritten by the "Selection.Borders(xlEdgeTop).LineStyle = xlNone"
expression.
Do I need the xnone lines at all?
--
Dave
Temping with Staffmark
in Rock Hill, SC
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default "Linestyle" in Macro

You can delete any of the border commands you don't want to actually change.
It might be better to comment them out first and test it to make sure it does
what you want.

--
Regards,
Tom Ogilvy


"Dave Birley" wrote:

I have a Macro that identifies some sets of Rows, and based on the result,
highlights them with a background color. Because some of the sets are
contiguous, I want to separate them with a thick line. This code works after
a fashion:

Selection.End(xlToLeft).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(("A" & NewStartRow - varOffset), ("S" &
NewStartRow - 1)).Select
With Selection.Interior
.ColorIndex = 40
.Pattern = xlSolid
End With
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone

However if there are two contiguous sets, the Line under the first set gets
overwritten by the "Selection.Borders(xlEdgeTop).LineStyle = xlNone"
expression.
Do I need the xnone lines at all?
--
Dave
Temping with Staffmark
in Rock Hill, SC

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 171
Default "Linestyle" in Macro

Did the Commenting this, and it worked like a charm!

Thanks!!!!
--
Dave
Temping with Staffmark
in Rock Hill, SC


"Tom Ogilvy" wrote:

You can delete any of the border commands you don't want to actually change.
It might be better to comment them out first and test it to make sure it does
what you want.

--
Regards,
Tom Ogilvy


"Dave Birley" wrote:

I have a Macro that identifies some sets of Rows, and based on the result,
highlights them with a background color. Because some of the sets are
contiguous, I want to separate them with a thick line. This code works after
a fashion:

Selection.End(xlToLeft).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(("A" & NewStartRow - varOffset), ("S" &
NewStartRow - 1)).Select
With Selection.Interior
.ColorIndex = 40
.Pattern = xlSolid
End With
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone

However if there are two contiguous sets, the Line under the first set gets
overwritten by the "Selection.Borders(xlEdgeTop).LineStyle = xlNone"
expression.
Do I need the xnone lines at all?
--
Dave
Temping with Staffmark
in Rock Hill, SC

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
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
What is fastest? "If .LineStyle < xlContinuous ..." or ".LineStyle = xlContinuous" ?? tskogstrom Excel Programming 12 April 16th 07 10:08 AM
Change default in input box from "20" to "000000"? Have macro continue on to name sheet tab? StargateFanFromWork[_4_] Excel Programming 7 October 29th 06 11:46 AM
Macro to concatenate into "B1" B2 thru B"x" based on new data in "Col A" Dennis Excel Discussion (Misc queries) 0 July 17th 06 02:38 PM
Sending macro based e-mail with built-in "Heading" and "Text" Prabha Excel Programming 3 January 17th 05 02:11 PM


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