ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Removing cell borders on any cell (https://www.excelbanter.com/excel-programming/332774-removing-cell-borders-any-cell.html)

Claudia

Removing cell borders on any cell
 
I'm familiar with writing code for Word 2003, and this is my first venture
into writing VBA code for Excel (2003). How can I edit the code (which
follows) to automatically remove the bottom border from *any* row rather than
removing it from a specific range? Following is the macro I recorded. I want
to replace the range with whatever code works in Excel to Select the same
number of cells. That way I could run the macro on any row. I guess what I
need to know is what is the Excel code for shift + right + right + right, so
that it selects a certain number of cells in the row? Here's the code:

Sub cmc1()
'
' cmc1 Macro
' Macro recorded 6/24/2005 by Claudia Carvalho
'
' Keyboard Shortcut: Ctrl+f
'
Range("A2779:I2779").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
Range("A2779").Select
End Sub


All times are GMT +1. The time now is 04:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com