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
  • Avatar do usuário
Por rafapmotta
Posts
#7370
Galera,

A macro que está na planilha em anexo, está mudando o numero de 14,225 para 14225,00 ,mas ela só deveria limpar os espaços escondidos em algumas celulas vazias.

O número precisa permanecer o mesmo (14,225) e nao 14225

Alguem sabe como ajustar?
Você não está autorizado a ver ou baixar esse anexo.
Avatar do usuário
Por Parkeless
Posts Avatar
#7372
Olá novamente Rafa!

Estranho; o VBA está trocando o ponto por vírgula, aí acaba mudando o número.

Multipliquei por 1 e corrigiu, vai entender kkk vê se funciona aí também:
Código: Selecionar todos
Sub teste1()

Dim LRi As Range, cell As Range

Set LRi = Range("I2:N" & Range("I2").End(xlDown).Row & "")
For Each cell In LRi
    If IsNumeric(cell) Then
        cell = WorksheetFunction.Trim(cell) * 1
    Else
        cell = WorksheetFunction.Trim(cell)
    End If
Next cell

End Sub
Avatar do usuário
Por Reinaldo
Avatar
#7373
A linguagem/padrão "interno" do VBA é basicamente o Americano, onde o separador decimal é ponto e o de milhar a virgula.

Experimente então alterar alinha da rotina conforme segue: cell.Value = Trim(Replace(cell.Value, ",", "."))
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