In the code below I would like to add a command to make the formula results and the text (total hours) to be in bold.

```
Private Sub CommandButton1_Click()
Dim lrow As Long
lrow = Cells(65536, "C").End(xlUp).Row
Cells(lrow + 2, "I").Formula = "=sum(I16:I" & lrow & ")"
Cells(lrow + 2, "J").Formula = "=sum(J16:J" & lrow & ")"
Cells(lrow + 2, "K").Formula = "=sum(K16:K" & lrow & ")"
Cells(lrow + 2, "L").Formula = "=sum(L16:L" & lrow & ")"
Cells(lrow + 2, "M").Formula = "=sum(M16:M" & lrow & ")"
Cells(lrow + 2, "N").Formula = "=sum(N16:N" & lrow & ")"
Cells(lrow + 2, "O").Formula = "=sum(O16:O" & lrow & ")"
Cells(lrow + 2, "F") = "Total Hours"
End Sub
```

```
Private Sub CommandButton2_Click()
Dim lrow As Long
lrow = Cells(65536, "C").End(xlUp).Row
Cells(lrow + 2, "I").Font.Bold=True
Cells(lrow + 2, "J").Font.Bold=True
Cells(lrow + 2, "K").Font.Bold=True
Cells(lrow + 2, "L").Font.Bold=True
Cells(lrow + 2, "M").Font.Bold=True
Cells(lrow + 2, "N").Font.Bold=True
Cells(lrow + 2, "O").Font.Bold=True
Cells(lrow + 2, "F").Font.Bold=True
End Sub
```

```
Private Sub CommandButton1_Click()
Dim lrow As Long
lrow = Cells(65536, "C").End(xlUp).Row
Cells(lrow + 2, "I").Formula = "=sum(I16:I" & lrow & ")"
Cells(lrow + 2, "J").Formula = "=sum(J16:J" & lrow & ")"
Cells(lrow + 2, "K").Formula = "=sum(K16:K" & lrow & ")"
Cells(lrow + 2, "L").Formula = "=sum(L16:L" & lrow & ")"
Cells(lrow + 2, "M").Formula = "=sum(M16:M" & lrow & ")"
Cells(lrow + 2, "N").Formula = "=sum(N16:N" & lrow & ")"
Cells(lrow + 2, "O").Formula = "=sum(O16:O" & lrow & ")"
Cells(lrow + 2, "F") = "Total Hours"
Range("I" & lrow + 2 & ":O" & lrow + 2).Font.Bold=True
Cells(lrow + 2, "F").Font.Bold=True
End Sub
```

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.

Open in new window