Underline

  • Thread starter Thread starter CAM
  • Start date Start date
C

CAM

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.

Cheers
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top