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
#69995
Ola eu criei uma planilha para controle de vadas que eu faço e nelas ocorrem parcelamento, eu lanço tudo na aba "lançamentos" e clico no botao lançar na aba "Vendas1" e tras tudo essa parte esta correta eu gostaria de uma formula vba para que no lançamento na aba "vendas1" ja venha com lançamentos dividos pela quantidade de x que informo no lançamento... tipo se o cliente comprou em 10x venha 10 linhas hora que clicar no botao
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) = "Emprestimo" 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, 8) 'Descrição
            Plan6.Cells(lin, 8) = Planilha1.Cells(i, 6) 'Parcela
            Plan6.Cells(lin, 9) = Planilha1.Cells(i, 9) 'Saida
            Plan6.Cells(lin, 12) = Planilha1.Cells(i, 14) 'Resolvido
            lin = lin + 1
           End If
        End If
        
          If Planilha1.Cells(i, 1) = "Recebimento" Then
        If Planilha1.Cells(i, 2) = "Emprestimo" 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, 8) 'Descrição
            Plan6.Cells(lin, 7) = Planilha1.Cells(i, 9) 'Entrada
            Plan6.Cells(lin, 12) = Planilha1.Cells(i, 14) '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) = "Emprestimo" 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, 9) 'Valor
            Plan6.Cells(lin, 18) = Planilha1.Cells(i, 8) 'Descrição
            Plan6.Cells(lin, 19) = Planilha1.Cells(i, 14) 'Resolvido
            lin = lin + 1
        End If
        End If
        
    Next
End Sub
o codigo que estou usando é esse acima e a planilha vou anexar a baixo a senha dela é 852
Controle teste.xlsm
Você não está autorizado a ver ou baixar esse anexo.
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