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 nelson288
#8377
macro tirar 0

Mensagempor jau288 » Dom Mar 06, 2016 11:08 pm
Saudações a todos.
Preciso de codigo vba para uma tabela ( h31:af31) tem vários números , e entre as células existem vários números "0 " . Preciso copiar os valores para outra tabela sem "0" . Coloco em anexo exemplo
Você não está autorizado a ver ou baixar esse anexo.
Avatar do usuário
Por alexandrevba
Avatar
#8390
Bom dia!!!

Tente algo asssim, favor adaptar o código...
Código: Selecionar todos
Sub AleVBA_1611()
    Dim wsSrc As Worksheet
    Dim wsDst As Worksheet

    Set wsSrc = Worksheets("Planilha1")
    Set wsDst = Worksheets("Planilha1")
    
    wsSrc.Range("B2:AB3").Copy
    wsDst.Range("AK2").PasteSpecial xlPasteValues, Transpose:=True
    
    For Each cell In Range("AK2:AL30")
        If cell.Value = "0" Then cell.Clear
    Next
    
    [AK1].Value = "Ale1"
    [AL1].Value = "Ale2"
    Range("AK1:AK30").Sort Key1:=Range("AK1"), Order1:=xlAscending, Header:=xlYes
    Range("AL1:AL30").Sort Key1:=Range("AL1"), Order1:=xlAscending, Header:=xlYes
    
    wsSrc.Range("AK2:AL30").Copy
    wsDst.Range("B20").PasteSpecial xlPasteValues, Transpose:=True
End Sub
Att
Por nelson288
#8457
Bom dia alexandrevba deu certo , obrigado pela atenção e pela ajuda foi muito útil.
Grato a todos...


jau
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