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 DennerSantos
Posts
#70624
Amigos eu tenho uma planilha para controlar gastos do cartao e ja tenho um codigo que quando eu clico no botao ele lança na planilha mais queria que agora por exemplo quando o valor fosse parcelado em por exemplo 3 vezes ele repetisse a linha 3 vezes e logo a baixo viria outro lançamento , tenho o codigo a baixa e nao entendo muito to montando aos pouquinhos
Código: Selecionar todos
Sub relatorio()
    Plan6.Range("A7:i1500").ClearContents
    ultimalinha = Planilha1.Cells(Rows.Count, "a").End(xlUp).Row
    lin = 7
    For i = 2 To ultimalinha
        If Planilha1.Cells(i, 1) = "Saida" Then
        If Planilha1.Cells(i, 2) = "cartao" Then
            Plan6.Cells(lin, 1) = Planilha1.Cells(i, 1) 'Movimento
            Plan6.Cells(lin, 2) = Planilha1.Cells(i, 3) 'Status
            Plan6.Cells(lin, 3) = DateValue(Format(Planilha1.Cells(i, 4), "dd/mm/yyyy")) 'data
            Plan6.Cells(lin, 4) = DateValue(Format(Planilha1.Cells(i, 5), "dd/mm/yyyy")) 'Vencimento
            Plan6.Cells(lin, 5) = Planilha1.Cells(i, 7) 'Pessoa
            Plan6.Cells(lin, 6) = Planilha1.Cells(i, 9) 'Descrição
            Plan6.Cells(lin, 8) = Planilha1.Cells(i, 6) 'Parcela
            Plan6.Cells(lin, 9) = Planilha1.Cells(i, 10) 'Saida
            Plan6.Cells(lin, 12) = Planilha1.Cells(i, 16) 'Resolvido
            lin = lin + 1
           End If
        End If
        
          If Planilha1.Cells(i, 1) = "Recebimento" Then
        If Planilha1.Cells(i, 2) = "caertao" Then
            Plan6.Cells(lin, 1) = Planilha1.Cells(i, 1) 'Movimento
            Plan6.Cells(lin, 2) = Planilha1.Cells(i, 3) 'Status
            Plan6.Cells(lin, 3) = DateValue(Format(Planilha1.Cells(i, 4), "dd/mm/yyyy")) 'data
            Plan6.Cells(lin, 5) = Planilha1.Cells(i, 7) 'Pessoa
            Plan6.Cells(lin, 6) = Planilha1.Cells(i, 9) 'Descrição
            Plan6.Cells(lin, 7) = Planilha1.Cells(i, 10) 'Entrada
            Plan6.Cells(lin, 12) = Planilha1.Cells(i, 16) 'Resolvido
            lin = lin + 1
            End If
        End If
        
    Next
End Sub

Sub buscar()
    Plan6.Range("o3:s28").ClearContents
    ultimalinha = Planilha1.Cells(Rows.Count, "n").End(xlUp).Row
    lin = 3
    For i = 2 To ultimalinha
        If Planilha1.Cells(i, 7) = Range("I2") Then
        If Planilha1.Cells(i, 2) = "cartao" Then
            Plan6.Cells(lin, 15) = Planilha1.Cells(i, 1) 'Movimento
            If Planilha1.Cells(i, 5) <> "" Then Plan6.Cells(lin, 16) = DateValue(Format(Planilha1.Cells(i, 5), "dd/mm/yyyy")) 'Vencimento
            Plan6.Cells(lin, 17) = Planilha1.Cells(i, 10) 'Valor
            Plan6.Cells(lin, 18) = Planilha1.Cells(i, 9) 'Descrição
            Plan6.Cells(lin, 19) = Planilha1.Cells(i, 16) 'Resolvido
            lin = lin + 1
        End If
        End If
        
    Next
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