View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLatham JLatham is offline
external usenet poster
 
Posts: 3,365
Default Help - Apply Formatting To Current Row

To keep from having to change it all too much, try this
Sub FatGreen()
'
' FatGreen Macro
' Macro recorded 8/4/2007 by kili
'
Dim theRow As Range
Set theRow = Selection.EntireRow

theRow.Borders(xlDiagonalDown).LineStyle = xlNone
theRow.Borders(xlDiagonalUp).LineStyle = xlNone
theRow.Borders(xlEdgeLeft).LineStyle = xlNone
With theRow.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = 4
End With
theRow.Borders(xlEdgeRight).LineStyle = xlNone
theRow.Borders(xlInsideVertical).LineStyle = xlNone

End Sub

" wrote:

Hello All,

I recorded a formula to apply a thick green border on the bottom of
the current row.

The recorded macro stored the following:

Sub FatGreen()
'
' FatGreen Macro
' Macro recorded 8/4/2007 by kili
'
Rows("104:104").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = 4
End With
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
' Range("A104").Select
End Sub

I'd like to be able to run this macro and have it apply on any current
/ selected row, but obviously the hardcoded Row number is the problem.

I've spent the last few hours on google's newsgroups archive's and
have come up empty-handed.

Any VBA suggestions would be much appreciated.

Thank you,
Heiko