Este fórum está sendo desativado

Depois de 9 anos, este fórum será desativado. Mas calma.... estamos migrando para uma comunidade no DISCORD. Junte-se a nós.

ENTRAR PARA DISCORD

Tópicos relacionados a códigos VBA, gravação de macros, etc.
Por walber
Posts
#33618
Boa tarde.

Uso este código em meu formulário e queria saber se tem com colocar uma condição para que não mostre o valor da linha.
Este é o código

With ThisWorkbook.Sheets("Plan1")
.Activate
For a = 2 To .Cells(Cells.Rows.Count, "A").End(xlUp).Row
Cells(a, "A").Select
If Cells(a, "A") <> "" Then
If Format(Month(Cells(a, "A")), "00") = Mes And Year(Cells(a, "A")) = Ano Then
somaPlan1Mes = somaPlan1Mes + CDbl(Format(Cells(a, "B"), "currency"))
End If
End If
Next

ele funciona somando os valores da coluna 2 da planilha conforme o mes escolhido, mas gostaria que quando tiver uma observação na coluna 3 da planilha, seja desconsiderado este valor.
tem como?
#33619
Se eu entendi seu codigo isso deve funcioanar

With ThisWorkbook.Sheets("Plan1")
.Activate
For a = 2 To .Cells(Cells.Rows.Count, "A").End(xlUp).Row
Cells(a, "A").Select
If Cells(a, "A") <> "" Then
If Format(Month(Cells(A, "A")), "00") = Mes And Year(Cells(A, "A")) = Ano Then
If Cells(a, "C" ) = "" Then ' acrecentei este if para pesquisar se a coluna C esta vazia se estiver executa a soma
somaPlan1Mes = somaPlan1Mes + CDbl(Format(Cells(a, "B"), "currency"))
End If
End If
End If
Next
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]

Estamos migrando para uma comunidade no Discord