S
SFrongillo_Lib
I have several columns/rows with data. I would like a macro to go and
find the cells that contain the word "Total" and select the row and
format it (bold, background color = 37)
For example:
A B C D
row1 10 10 2.7 3.5
row2 11 Total 2.7 3.5
row3 12 12 total 4.5
The word "Total" may appear in any column or any row within the data
range. Some rows may not have the word total.
I'd like the macro to find the word "Total" and then highlight from
Column A through the end of the row and format it.
I have a macro that will bold from the word "Total to the end of row."
Here's the code for that:
Sub BoldTotals()
' Macro finds all cells containing the word TOTAL and applies
' Bold, underline and shading to the row
Dim LastColumn As Integer
LastColumn = ActiveSheet.Cells.SpecialCells(xlLastCell).Column
For Each C In ActiveSheet.UsedRange
If C Like "*TOTAL*" Or C Like "*Total*" Then
' select from current cell to end of range
Range(C, C.Offset(0, (LastColumn - C.Column))).Activate
' set those cells to bold
With Selection
.Font.Bold = True
.Interior.ColorIndex = 37
.Borders(xlTop).Weight = xlThin
.Borders(xlBottom).Weight = xlMedium
End With
End If
Next
Application.ScreenUpdating = True
End Sub
Rather than selecting from the word Total to the right (end of row),
I'd like to highlight and format the whole row.
Any suggestions? This was a macro given to me and I'm not that good in
scripting these. Thanks for any help!
find the cells that contain the word "Total" and select the row and
format it (bold, background color = 37)
For example:
A B C D
row1 10 10 2.7 3.5
row2 11 Total 2.7 3.5
row3 12 12 total 4.5
The word "Total" may appear in any column or any row within the data
range. Some rows may not have the word total.
I'd like the macro to find the word "Total" and then highlight from
Column A through the end of the row and format it.
I have a macro that will bold from the word "Total to the end of row."
Here's the code for that:
Sub BoldTotals()
' Macro finds all cells containing the word TOTAL and applies
' Bold, underline and shading to the row
Dim LastColumn As Integer
LastColumn = ActiveSheet.Cells.SpecialCells(xlLastCell).Column
For Each C In ActiveSheet.UsedRange
If C Like "*TOTAL*" Or C Like "*Total*" Then
' select from current cell to end of range
Range(C, C.Offset(0, (LastColumn - C.Column))).Activate
' set those cells to bold
With Selection
.Font.Bold = True
.Interior.ColorIndex = 37
.Borders(xlTop).Weight = xlThin
.Borders(xlBottom).Weight = xlMedium
End With
End If
Next
Application.ScreenUpdating = True
End Sub
Rather than selecting from the word Total to the right (end of row),
I'd like to highlight and format the whole row.
Any suggestions? This was a macro given to me and I'm not that good in
scripting these. Thanks for any help!