分享

将该行指定区域为0的选中

 yuxinrong 2019-01-09
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

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多