|
本帖最后由 tfzyes 于 2016-7-6 12:52 编辑
If Cells(1, 2) = 0 And Cells(1, 3) = 0 And Cells(1, 4) = 0 And Cells(1, 5) = 0 And Cells(1, 6) = 0 And Cells(1, 7) = 0 And Cells(1, 8) = 0 And Cells(1, 9) = 0 And Cells(1, 10) = 0 And Cells(1, 11) = 0 And Cells(1, 12) = 0 And Cells(1, 13) = 0 Then Range("B2") = 0: Exit Sub
If Cells(1, 2) <> 0 Or Cells(1, 3) <> 0 Or Cells(1, 4) <> 0 Or Cells(1, 5) <> 0 Or Cells(1, 6) <> 0 Or Cells(1, 7) <> 0 Or Cells(1, 8) <> 0 Or Cells(1, 9) <> 0 Or Cells(1, 10) <> 0 Or Cells(1, 11) <> 0 Or Cells(1, 12) <> 0 Or Cells(1, 13) <> 0 Then
其实就是说B1:N1全为0时如何表达,B1:N1只要一个不为0时如何表达
- Sub text()
- Dim a As Range
- For Each a In [B1:N1]
- If a.Value = 0 Then
- k = k + 1
- End If
- Next
- If k = 0 Then
- MsgBox "都不为零蛋"
- ElseIf k = 13 Then
- MsgBox "都为零蛋"
- Else
- MsgBox "不都为零蛋"
- End If
- End Sub
复制代码
|
|