Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
What is fastest? "If .LineStyle < xlContinuous ..." or ".LineStyle = xlContinuous" ?? | Excel Programming | |||
Change default in input box from "20" to "000000"? Have macro continue on to name sheet tab? | Excel Programming | |||
Macro to concatenate into "B1" B2 thru B"x" based on new data in "Col A" | Excel Discussion (Misc queries) | |||
Sending macro based e-mail with built-in "Heading" and "Text" | Excel Programming |