Sub 将该行全部是0的选中() Dim i As Integer, j As Integer, rng As Range, rng1 As Range, str As String str = [b2:b1000].Find(What:="科目名称", LookIn:=xlValues).Address j = Mid(str, 4, Len(str) - 3) For i = j + 1 To Range("b10000").End(3).Row - 1 Set rng = Range(Cells(i, 3), Cells(i, 10)) If WorksheetFunction.Sum(rng) <= 0 Then ' If Not rng Is Nothing Then ' Set rng = Range(Cells(i, 3), Cells(i, 10)) If rng1 Is Nothing Then Set rng1 = rng ' Range(Cells(i, 3), Cells(i, 10)) End If Set rng1 = Union(rng1, rng) ' Range(Cells(i, 3), Cells(i, 10))) ' rng.Select End If ' Set rng1 = Union(rng, rng1) ' Rows(i).Select ' rng1.Select 'End If ' End If Next With rng1 .Select ' .Interior.Color = 3 .Interior.ThemeColor = 5 End With End Sub
|
|