ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Underline (https://www.excelbanter.com/excel-programming/424412-underline.html)

CAM

Underline
 
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


Dick Kusleika[_4_]

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


All times are GMT +1. The time now is 03:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com