在excel里如何利用VBA实现图中所要求的处理?
发布网友
发布时间:2022-11-24 23:02
我来回答
共1个回答
热心网友
时间:2023-10-05 03:31
Sub test4()
Dim i&, j&
Range([b2], [p4]).ClearFormats
For i = 2 To 4
For j = 2 To 16
If Cells(i, j) = "" Then
Cells(i, j).Interior.Color = vbGreen
GoTo Step1
End If
Next j
Step1:
If i = 2 Then
Cells(i, 17) = "=b" & i & "+sum(d" & i & ":f" & i & ")+sum(h" & i & ":m" & i & ")"
Else
Cells(i, 17) = "=sum(b" & i & "+d" & i & ")+sum(f" & i & ":i" & i & ")+sum(k" & i & ":o" & i & ")"
End If
Next i
End Sub