Thread: Formating cells
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Greg Glynn Greg Glynn is offline
external usenet poster
 
Posts: 137
Default Formating cells


Patrick Simonds wrote:
I need a piece of code to insert into a routine. What I need is for the code
to place a boarder around each cell (column A through T) of the current row.
The curser will not always be in the same cell when the code is run.


Sub Macro1()
'
' Macro1 Macro
' Macro recorded 22/11/2006 by Greg Glynn
'
For x = 1 To 20
Cells(ActiveCell.Row, x).Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Next x
End Sub