Cái đoạn dài dàiBạn thử nhe
With Sh.Cells(eRw, "D").Offset(1)
.FormulaR1C1 = "=SUM(R[-" & rW & "]C:R[-1]C)"
.Font.Bold = True
End With
With Sh.Cells(eRw, "E").Offset(1)
.FormulaR1C1 = "=SUM(R[-" & rW & "]C:R[-1]C)"
.Font.Bold = True
End With
With Sh.Cells(eRw, "F").Offset(1)
.FormulaR1C1 = "=SUM(R[-" & rW & "]C:R[-1]C)"
.Font.Bold = True
End With
With Sh.Cells(eRw, "G").Offset(1)
.FormulaR1C1 = "=SUM(R[-" & rW & "]C:R[-1]C)"
.Font.Bold = True
End With
With Sh.Range("D" & eRw).Resize(, 4).Offset(1)
.FormulaR1C1 = "=SUM(R[-" & rW & "]C:R[-1]C)"
.Font.Bold = True
End With
Em đã chỉnh lạiCái đoạn dài dài
Có thể thay như thế nỳ cho gọnMã:With Sh.Cells(eRw, "D").Offset(1) .FormulaR1C1 = "=SUM(R[-" & rW & "]C:R[-1]C)" .Font.Bold = True End With With Sh.Cells(eRw, "E").Offset(1) .FormulaR1C1 = "=SUM(R[-" & rW & "]C:R[-1]C)" .Font.Bold = True End With With Sh.Cells(eRw, "F").Offset(1) .FormulaR1C1 = "=SUM(R[-" & rW & "]C:R[-1]C)" .Font.Bold = True End With With Sh.Cells(eRw, "G").Offset(1) .FormulaR1C1 = "=SUM(R[-" & rW & "]C:R[-1]C)" .Font.Bold = True End With
Mã:With Sh.Range("D" & eRw).Resize(, 4).Offset(1) .FormulaR1C1 = "=SUM(R[-" & rW & "]C:R[-1]C)" .Font.Bold = True End With
Để dòng tổng cộng ở dòng trống đầu tiên ahĐể dòng tổng bên trên được không?