I wrote this VBA code to sum only the cells in column "H" that are bold font and place the answer after the last row.
Now I'd like to enhance it by adding a loop that repeats the same function across multiple columns, e.g. H through AF.
Im not sure how to code a nested loop that would perform the same summation across multiple columns...any assistance would be appreciated...
Sub bold()
Dim row As Long
Dim LastRow As Long
'---------------------------------------------------------------------------------------
' Use the Count property of Rows to detect the number of rows in the active sheet
' Detect the last row of data in a column, working from the bottom of the worksheet up
'---------------------------------------------------------------------------------------
LastRow = Range("H" & Rows.Count).End(xlUp).row
For row = 1 To LastRow
If Range("H" & row).Font.bold = True Then
Range("H" & LastRow + 1).Value = Range("H" & LastRow + 1).Value + Range("H" & row).Value
End If
Next row
End Sub
Bookmarks