|
楼主 |
发表于 2019-1-21 15:41
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
最后一次更新:
在行循环内做了列循环,作为新手,很满足了
Sub 数据()
Dim i%, n%
Dim rng As Range
For Each rng In Range("B2:L50")
If rng.Value > 0 Then
rng.Value = 0
End If
Next
For i = 2 To [a65536].End(3).Row
If (Cells(i, 2) < 0 And Cells(i, 2) + Cells(i, 17) > 0) Then
Range("b" & i).FormatConditions.Delete
Range("b" & i).Interior.ColorIndex = 10
End If
For n = 3 To 11
If (Cells(i, n) < 0 And Application.Sum(Range(Cells(i, 2), Cells(i, n))) + Cells(i, 17) > 0) Then
Cells(i, n).FormatConditions.Delete
Cells(i, n).Interior.ColorIndex = 10
End If
Next
If Cells(i, 12) + Cells(i, 17) > 0 Then
Cells(i, 12).FormatConditions.Delete
Cells(i, 12).Interior.ColorIndex = 10
End If
Next
End Sub
|
|