Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I want to write a border only around A7:C11 and A12:C16 (in different sheets), not in rows in between. I wrote down this code and I am getting lines at every row..any idea how I should change that? Thanks Sub Set_Borders() Dim sht As Worksheet For Each sht In ActiveWorkbook.Sheets With sht.Range("A7:C11") .Borders(xlDiagonalDown).LineStyle = xlNone .Borders(xlDiagonalUp).LineStyle = xlNone .Borders(xlEdgeLeft).LineStyle = xlContinuous .Borders(xlEdgeRight).LineStyle = xlContinuous .Borders(xlEdgeTop).LineStyle = xlContinuous .Borders(xlEdgeBottom).LineStyle = xlContinuous .Borders.Weight = xlMedium .Borders.ColorIndex = xlAutomatic End With With sht.Range("A12:C16") .Borders(xlDiagonalDown).LineStyle = xlNone .Borders(xlDiagonalUp).LineStyle = xlNone .Borders(xlEdgeLeft).LineStyle = xlContinuous .Borders(xlEdgeRight).LineStyle = xlContinuous .Borders(xlEdgeTop).LineStyle = xlContinuous .Borders(xlEdgeBottom).LineStyle = xlContinuous .Borders.Weight = xlMedium .Borders.ColorIndex = xlAutomatic End With Next sht End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Nigel,
I am still getting borders at any single row, can you show me exactly where I should insert those 2 lines? "Nigel" wrote: Add the following two lines to the setting for the range(s) .Borders(xlInsideVertical).LineStyle = xlNone .Borders(xlInsideHorizontal).LineStyle = xlNone -- Regards, Nigel "Faboboren" wrote in message ... Hi, I want to write a border only around A7:C11 and A12:C16 (in different sheets), not in rows in between. I wrote down this code and I am getting lines at every row..any idea how I should change that? Thanks Sub Set_Borders() Dim sht As Worksheet For Each sht In ActiveWorkbook.Sheets With sht.Range("A7:C11") .Borders(xlDiagonalDown).LineStyle = xlNone .Borders(xlDiagonalUp).LineStyle = xlNone .Borders(xlEdgeLeft).LineStyle = xlContinuous .Borders(xlEdgeRight).LineStyle = xlContinuous .Borders(xlEdgeTop).LineStyle = xlContinuous .Borders(xlEdgeBottom).LineStyle = xlContinuous .Borders.Weight = xlMedium .Borders.ColorIndex = xlAutomatic End With With sht.Range("A12:C16") .Borders(xlDiagonalDown).LineStyle = xlNone .Borders(xlDiagonalUp).LineStyle = xlNone .Borders(xlEdgeLeft).LineStyle = xlContinuous .Borders(xlEdgeRight).LineStyle = xlContinuous .Borders(xlEdgeTop).LineStyle = xlContinuous .Borders(xlEdgeBottom).LineStyle = xlContinuous .Borders.Weight = xlMedium .Borders.ColorIndex = xlAutomatic End With Next sht End Sub |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() You can use the BorderAround method to create a border around a range of cells. E.g., Worksheets("Sheet1").Range("A7:C11").BorderAround _ LineStyle:=xlSolid, Weight:=xlMedium, ColorIndex:=xlAutomatic Worksheets("Sheet2").Range("A12:C16").BorderAround _ LineStyle:=xlSolid, Weight:=xlMedium, ColorIndex:=xlAutomatic Cordially, Chip Pearson Microsoft Most Valuable Professional Excel Product Group, 1998 - 2009 Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Thu, 12 Feb 2009 06:29:11 -0800, Faboboren wrote: Hi, I want to write a border only around A7:C11 and A12:C16 (in different sheets), not in rows in between. I wrote down this code and I am getting lines at every row..any idea how I should change that? Thanks Sub Set_Borders() Dim sht As Worksheet For Each sht In ActiveWorkbook.Sheets With sht.Range("A7:C11") .Borders(xlDiagonalDown).LineStyle = xlNone .Borders(xlDiagonalUp).LineStyle = xlNone .Borders(xlEdgeLeft).LineStyle = xlContinuous .Borders(xlEdgeRight).LineStyle = xlContinuous .Borders(xlEdgeTop).LineStyle = xlContinuous .Borders(xlEdgeBottom).LineStyle = xlContinuous .Borders.Weight = xlMedium .Borders.ColorIndex = xlAutomatic End With With sht.Range("A12:C16") .Borders(xlDiagonalDown).LineStyle = xlNone .Borders(xlDiagonalUp).LineStyle = xlNone .Borders(xlEdgeLeft).LineStyle = xlContinuous .Borders(xlEdgeRight).LineStyle = xlContinuous .Borders(xlEdgeTop).LineStyle = xlContinuous .Borders(xlEdgeBottom).LineStyle = xlContinuous .Borders.Weight = xlMedium .Borders.ColorIndex = xlAutomatic End With Next sht End Sub |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Perfect, Thanks
"Chip Pearson" wrote: You can use the BorderAround method to create a border around a range of cells. E.g., Worksheets("Sheet1").Range("A7:C11").BorderAround _ LineStyle:=xlSolid, Weight:=xlMedium, ColorIndex:=xlAutomatic Worksheets("Sheet2").Range("A12:C16").BorderAround _ LineStyle:=xlSolid, Weight:=xlMedium, ColorIndex:=xlAutomatic Cordially, Chip Pearson Microsoft Most Valuable Professional Excel Product Group, 1998 - 2009 Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Thu, 12 Feb 2009 06:29:11 -0800, Faboboren wrote: Hi, I want to write a border only around A7:C11 and A12:C16 (in different sheets), not in rows in between. I wrote down this code and I am getting lines at every row..any idea how I should change that? Thanks Sub Set_Borders() Dim sht As Worksheet For Each sht In ActiveWorkbook.Sheets With sht.Range("A7:C11") .Borders(xlDiagonalDown).LineStyle = xlNone .Borders(xlDiagonalUp).LineStyle = xlNone .Borders(xlEdgeLeft).LineStyle = xlContinuous .Borders(xlEdgeRight).LineStyle = xlContinuous .Borders(xlEdgeTop).LineStyle = xlContinuous .Borders(xlEdgeBottom).LineStyle = xlContinuous .Borders.Weight = xlMedium .Borders.ColorIndex = xlAutomatic End With With sht.Range("A12:C16") .Borders(xlDiagonalDown).LineStyle = xlNone .Borders(xlDiagonalUp).LineStyle = xlNone .Borders(xlEdgeLeft).LineStyle = xlContinuous .Borders(xlEdgeRight).LineStyle = xlContinuous .Borders(xlEdgeTop).LineStyle = xlContinuous .Borders(xlEdgeBottom).LineStyle = xlContinuous .Borders.Weight = xlMedium .Borders.ColorIndex = xlAutomatic End With Next sht End Sub |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Chip,
How I avoid to run the macros in my Macro sheet called Macros with these 4 lines?... Sub Set_Borders() Dim sht As Worksheet For Each sht In ActiveWorkbook.Sheets With sht.Range("A7:C11") "Chip Pearson" wrote: You can use the BorderAround method to create a border around a range of cells. E.g., Worksheets("Sheet1").Range("A7:C11").BorderAround _ LineStyle:=xlSolid, Weight:=xlMedium, ColorIndex:=xlAutomatic Worksheets("Sheet2").Range("A12:C16").BorderAround _ LineStyle:=xlSolid, Weight:=xlMedium, ColorIndex:=xlAutomatic Cordially, Chip Pearson Microsoft Most Valuable Professional Excel Product Group, 1998 - 2009 Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Thu, 12 Feb 2009 06:29:11 -0800, Faboboren wrote: Hi, I want to write a border only around A7:C11 and A12:C16 (in different sheets), not in rows in between. I wrote down this code and I am getting lines at every row..any idea how I should change that? Thanks Sub Set_Borders() Dim sht As Worksheet For Each sht In ActiveWorkbook.Sheets With sht.Range("A7:C11") .Borders(xlDiagonalDown).LineStyle = xlNone .Borders(xlDiagonalUp).LineStyle = xlNone .Borders(xlEdgeLeft).LineStyle = xlContinuous .Borders(xlEdgeRight).LineStyle = xlContinuous .Borders(xlEdgeTop).LineStyle = xlContinuous .Borders(xlEdgeBottom).LineStyle = xlContinuous .Borders.Weight = xlMedium .Borders.ColorIndex = xlAutomatic End With With sht.Range("A12:C16") .Borders(xlDiagonalDown).LineStyle = xlNone .Borders(xlDiagonalUp).LineStyle = xlNone .Borders(xlEdgeLeft).LineStyle = xlContinuous .Borders(xlEdgeRight).LineStyle = xlContinuous .Borders(xlEdgeTop).LineStyle = xlContinuous .Borders(xlEdgeBottom).LineStyle = xlContinuous .Borders.Weight = xlMedium .Borders.ColorIndex = xlAutomatic End With Next sht End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Borders | Excel Discussion (Misc queries) | |||
Borders | Excel Discussion (Misc queries) | |||
Borders | Excel Programming | |||
Borders | Excel Programming | |||
borders | Excel Programming |