![]() |
Macro - Clear Borders
Give this a whirl...
sub test Range("A1:B50").Borders.LineStyle = xlNone end sub -- HTH... Jim Thomlinson "Finance Guru" wrote: Hi All, I know how to clear the contents of cells in a macro,ie. Range("A1:B50").ClearContents - however can anyone tell me what needs to be included in a macro to clear "Borders" created around cells for a given range. I am just getting into creating macros - so if the above is not clear,please let me know. Thank you |
Macro - Clear Borders
To account for diagonals revise to this.
Sub test() With Range("A1:B50") .Borders.LineStyle = xlNone .Borders(xlDiagonalDown).LineStyle = xlNone .Borders(xlDiagonalUp).LineStyle = xlNone End With End Sub Gord Dibben MS Excel MVP On Wed, 21 Nov 2007 10:15:02 -0800, Jim Thomlinson wrote: Give this a whirl... sub test Range("A1:B50").Borders.LineStyle = xlNone end sub |
Macro - Clear Borders
And I just learned something new. I did not realize that my original code did
not remove the diagonals. That being said I can honestly say I have never used the diagonals... but if I ever do... Thanks Gord -- HTH... Jim Thomlinson "Gord Dibben" wrote: To account for diagonals revise to this. Sub test() With Range("A1:B50") .Borders.LineStyle = xlNone .Borders(xlDiagonalDown).LineStyle = xlNone .Borders(xlDiagonalUp).LineStyle = xlNone End With End Sub Gord Dibben MS Excel MVP On Wed, 21 Nov 2007 10:15:02 -0800, Jim Thomlinson wrote: Give this a whirl... sub test Range("A1:B50").Borders.LineStyle = xlNone end sub |
Macro - Clear Borders
Not only doesn't it remove diagonals, it adds diagonals to cells in the range
that don't originally have them. Set A1:B10 with cell borders and include diagonals. Run your original macro. Clears the outside and interior borders in A1:B10 but leaves the diagonals and also adds them to A11:B50 Note: the diagonals are actually doubled up so if you go to FormatCellBorders you have to click twice to clear them. Not nice and definitely weird<g Gord On Wed, 21 Nov 2007 11:54:04 -0800, Jim Thomlinson wrote: And I just learned something new. I did not realize that my original code did not remove the diagonals. That being said I can honestly say I have never used the diagonals... but if I ever do... Thanks Gord |
Macro - Clear Borders
Spookey... This one darn near fits into JWalk's XL oddities.
This has re-affirmed my desire to just never use diagonals. That being said many moons from now I am going to break down and use them for some obscure reason and my code will mess them up. On that day I will (vaguely) recall this conversation with a sense of (told you so)... -- HTH... Jim Thomlinson "Gord Dibben" wrote: Not only doesn't it remove diagonals, it adds diagonals to cells in the range that don't originally have them. Set A1:B10 with cell borders and include diagonals. Run your original macro. Clears the outside and interior borders in A1:B10 but leaves the diagonals and also adds them to A11:B50 Note: the diagonals are actually doubled up so if you go to FormatCellBorders you have to click twice to clear them. Not nice and definitely weird<g Gord On Wed, 21 Nov 2007 11:54:04 -0800, Jim Thomlinson wrote: And I just learned something new. I did not realize that my original code did not remove the diagonals. That being said I can honestly say I have never used the diagonals... but if I ever do... Thanks Gord |
All times are GMT +1. The time now is 03:52 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com