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.
  • Avatar do usuário
Por lecipriano
#13097
Galera, bom dia
Vejam se vocês podem me ajudar, preciso fazer uma macro utilizando a função atingir meta para zerar determinada coluna, utilizei o código abaixo, mas, não está correto...

Sub preco_venda()

Dim i As Single
Dim n As Single

i = 2
n = (Cells(2, 3) - Cells(2, 4))

Do While n <> 0
Cells(i, 5) = n
Cells(i, 3).GoalSeek Goal:=Cells(i, 4), ChangingCell:=Cells(i, 2)

i = i + 1
Loop

End Sub
Avatar do usuário
Por LuizSegecs
Posts Avatar
#13137
Boa noite!
Confesso que não consegui entender muito bem...mas dá uma olhada se essa macro é algo parecido com o que você quer.
Por lecipriano
#13176
Olá, Luiz
Obrigado pela ajuda, eu resolvi este problema com o seguinte código abaixo:

Sub preco_venda()
Dim i As Single
i = 2
Do While Cells(i, 5) <> ""
Cells(i, 3).GoalSeek Goal:=Cells(i, 4), ChangingCell:=Cells(i, 2)

i = i + 1
Loop

MsgBox "Cálculo Executado", vbExclamation
End Sub
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