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 OrfeuVBA
Posts
#321
Boa tarde,

Estou com a planilha em anexo onde através do código abaixo é realizado a soma da coluna L. No valor da coluna J preciso que o valor seja arredondado para baixo, porém esta arredondando para cima.
Código: Selecionar todos
Sub SomaReparte()

Dim vReparte As Long
Dim vTotal As Long
Dim vPacote As Long

For vReparte = 2 To Plan1.Cells(Rows.Count, "L").End(xlUp).Row
    vTotal = vTotal + Plan1.Cells(vReparte, "L")
Next

vPacote = vTotal / 20

[L65000].End(xlUp).Offset(1, 0).Value = vTotal
[L65000].End(xlUp).Offset(0, -2).Value = vPacote





End Sub


Se realizar a divisão de 6698 por 20 o valor é 334,9 preciso que seja arredondado para 334. Alguém pode me ajudar?
Você não está autorizado a ver ou baixar esse anexo.
Avatar do usuário
Por alexandrevba
Avatar
#328
Boa tarde!!

Já tentou a função RoundDown?
Código: Selecionar todos
vPacote = Application.WorksheetFunction.RoundDown((vTotal / 20), 0)
Tente adaptar...

Att
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