Procurar valor negativo!

Leo

05-10-2016 20:36:20

Olá,

Sou novo no fórum e iniciante em VBA, estou precisando de algo bastante simples, preciso criar um código que procure valores negativos em uma determinada coluna.

Quem puder ajudar agradeço! :)

Abraços.

Mauro Coutinho

06-10-2016 00:55:30

Veja se é isto, só ajuste a Coluna a verificar :

Código: Selecionar todos

Sub Find_Negativos()
    Dim sRg As Range
    Dim sValor
    Dim sUltLin As Long
        
    sUltLin = Sheets("Plan1").Range("A" & Rows.Count).End(xlUp).Row
        
    Set sRg = Range("A2" & ":" & "A" & sUltLin)

    For Each x In sRg
        
        If x < 0 Then
            MsgBox "O Valor :- " & x & " é Negativo"
        End If
        
    Next x

End Sub

Leo

13-01-2017 15:48:07

Valeu, funcionou!!!