使用countif然后离开

时间:2015-07-07 08:02:07

标签: vba excel-vba excel

我目前有以下代码,是否可以通过使用countif并改进它来改进它?

Sub leading_zeros()

    For Each Cell In Range("B:B")

        If Left(cell.value,1) = 0 Then

            MsgBox "This files has lines with leading zeros, once saved rename the file .csv"

            Exit Sub

        End If

        Next Cell


End Sub

1 个答案:

答案 0 :(得分:0)

Sub leading_zeros()

如果Application.WorksheetFunction.CountIf(Range(“I:I”),“0 *”)<> 0然后

MsgBox“此文件包含前导零的行,一旦保存重命名 文件.csv“

其他

结束如果