L
L. Howard
With the activecell in column C selected, this does a decent job of running from C to column V and formats the cells borders as wanted.
It is a bit slow but is not dealing with massive volumes of cells and its use is not "gotta get as many as possible done as soon as possible" type scenario.
However, I am wondering if there is a way to code this to act on a specified row that does the range all at once. Say an inputbox asking for the row number.
The inputbox I can do myself, the greater hurdles are this:
You will note that the first cell borders are three sided and then the next cell is four sided. So a two cell range in the row will have a left, right, top and bottom as a solid border line and a vertical light dotted line as a divider.
Secondly the row may have some cells that are colorindex various colors. (To tell the user these cells are reserved and not available.)
On the rows with the some colors in them, I need the border formatting code to skip those and continue to column V.
Skipping the colors is my major hurdle. And staying in sequence with the cells that take three borders and the cells that take four borders.
Thanks.
Howard
Option Explicit
Sub ReFormatRow()
'/ From column C to column V
Dim i As Long
For i = 1 To 10
With ActiveCell.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With ActiveCell.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With ActiveCell.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
ActiveCell.Offset(, 1).Select
With ActiveCell.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlHairline
End With
With ActiveCell.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With ActiveCell.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With ActiveCell.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
ActiveCell.Offset(, 1).Select
Next
End Sub
It is a bit slow but is not dealing with massive volumes of cells and its use is not "gotta get as many as possible done as soon as possible" type scenario.
However, I am wondering if there is a way to code this to act on a specified row that does the range all at once. Say an inputbox asking for the row number.
The inputbox I can do myself, the greater hurdles are this:
You will note that the first cell borders are three sided and then the next cell is four sided. So a two cell range in the row will have a left, right, top and bottom as a solid border line and a vertical light dotted line as a divider.
Secondly the row may have some cells that are colorindex various colors. (To tell the user these cells are reserved and not available.)
On the rows with the some colors in them, I need the border formatting code to skip those and continue to column V.
Skipping the colors is my major hurdle. And staying in sequence with the cells that take three borders and the cells that take four borders.
Thanks.
Howard
Option Explicit
Sub ReFormatRow()
'/ From column C to column V
Dim i As Long
For i = 1 To 10
With ActiveCell.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With ActiveCell.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With ActiveCell.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
ActiveCell.Offset(, 1).Select
With ActiveCell.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlHairline
End With
With ActiveCell.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With ActiveCell.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With ActiveCell.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
ActiveCell.Offset(, 1).Select
Next
End Sub