Hello,
I have a macro to find a range of cells and place a total below the last cell with data. I'd like it to put the sum in bold but I've only managed to get it to make the first cell with data bold. I also would like to add in some code to find the last cell with data in the A column and write "Totals:" in bold below it if you are up to it. I'm sure it is simple but I appreciate any help.
Sub Totals()
Range("C15", Range("C15").End(xlDown)).Select
Dim rng As Range
With Selection.Areas
With .Item(.Count)
.Offset(.Rows.Count).Resize(1).Formula = "=SUM(" & Selection.Address & ")"
ActiveCell.Font.Bold
End With
End With
Range("D15", Range("D15").End(xlDown)).Select
Dim rng2 As Range
With Selection.Areas
With .Item(.Count)
.Offset(.Rows.Count).Resize(1).Formula = "=SUM(" & Selection.Address & ")"
End With
End With
Range("E15", Range("E15").End(xlDown)).Select
Dim rng3 As Range
With Selection.Areas
With .Item(.Count)
.Offset(.Rows.Count).Resize(1).Formula = "=SUM(" & Selection.Address & ")"
End With
End With
Range("F15", Range("F15").End(xlDown)).Select
Dim rng4 As Range
With Selection.Areas
With .Item(.Count)
.Offset(.Rows.Count).Resize(1).Formula = "=SUM(" & Selection.Address & ")"
End With
End With
End Sub
I have a macro to find a range of cells and place a total below the last cell with data. I'd like it to put the sum in bold but I've only managed to get it to make the first cell with data bold. I also would like to add in some code to find the last cell with data in the A column and write "Totals:" in bold below it if you are up to it. I'm sure it is simple but I appreciate any help.
Sub Totals()
Range("C15", Range("C15").End(xlDown)).Select
Dim rng As Range
With Selection.Areas
With .Item(.Count)
.Offset(.Rows.Count).Resize(1).Formula = "=SUM(" & Selection.Address & ")"
ActiveCell.Font.Bold
End With
End With
Range("D15", Range("D15").End(xlDown)).Select
Dim rng2 As Range
With Selection.Areas
With .Item(.Count)
.Offset(.Rows.Count).Resize(1).Formula = "=SUM(" & Selection.Address & ")"
End With
End With
Range("E15", Range("E15").End(xlDown)).Select
Dim rng3 As Range
With Selection.Areas
With .Item(.Count)
.Offset(.Rows.Count).Resize(1).Formula = "=SUM(" & Selection.Address & ")"
End With
End With
Range("F15", Range("F15").End(xlDown)).Select
Dim rng4 As Range
With Selection.Areas
With .Item(.Count)
.Offset(.Rows.Count).Resize(1).Formula = "=SUM(" & Selection.Address & ")"
End With
End With
End Sub