Thread: Underline
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dick Kusleika[_4_] Dick Kusleika[_4_] is offline
external usenet poster
 
Posts: 595
Default Underline

On Thu, 19 Feb 2009 21:38:06 -0800, "CAM" wrote:

Hello,

I have a worksheet that I want to put a border line on top of summary
amounts from column A to J I want this done only when there is a text in
column A that contains "Total" For every text that has "Total" in column A
I want to have the border line. There are many "Totals" in the worksheet
and I don't want to manually put the border line. How do I do that in vba.
I am using Excel 2007 any tips will be appreciated. Thank you in advance.


Sub UnderlineTotal()

Dim rCell As Range

For Each rCell In Sheet1.UsedRange.Columns(1).Cells
If rCell.Value = "Total" Then
rCell.Resize(1, 10).Borders(xlEdgeTop).LineStyle = xlContinuous
End If
Next rCell

End Sub
--
Dick