|
G列に限定するとして、複数の計算範囲を一気に処理するなら
Sub Test_MySum()
Dim MyR As Range, C As Range
Dim Ad As String
On Error Resume Next
With Range("G:G")
Set MyR = .SpecialCells(2, 1)
If MyR Is Nothing Then Exit Sub
.SpecialCells(3).ClearContents
.Font.ColorIndex = xlColorIndexAutomatic
End With
On Error GoTo 0: Err.Clear
For Each C In MyR.Areas
Ad = C.Address
With C.Cells(1).Offset(C.Count)
.Formula = "=ROUND(SUM(" & Ad & ")*0.7,-2)"
.Font.ColorIndex = 5
End With
Next
Set MyR = Nothing
End Sub
数式を入れたセルは、青色の文字にして分かりやすくしています。
|
|