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
#69609
Boa noite, alguém poderia por favor me ajudar com o exemplo em anexo, na tela FLancamento gostaria que ao Clicar em Pesquisa Cliente ao abrir a listbox ao dar duplo clique ou clicar em Selecionar no cliente preenchesse o campo código e nome do form FLancamento. Desde já agradeço.
Você não está autorizado a ver ou baixar esse anexo.
#69612
Caro amigo, deu erro pra mim ao carregar a listbox, gerei um novo código.
Código: Selecionar todos
Sub Carregar_Listbox()
Dim linha, coluna As Long
Dim arrayItems()
    
    With Planilha1
        ReDim arrayItems(1 To .UsedRange.Rows.Count, 1 To .UsedRange.Columns.Count)
        Me.ListBox1.ColumnCount = .UsedRange.Columns.Count
        For linha = 1 To .UsedRange.Rows.Count
            Me.ListBox1.AddItem
            For coluna = 2 To .UsedRange.Columns.Count
                arrayItems(linha, coluna - 1) = .Cells(linha, coluna).Value
            Next coluna
        Next linha
        
        Me.ListBox1.List = arrayItems()
    End With
End Sub
Com a listbox preenchida, coloque no evento duplo clique a rotina abaixo:
Código: Selecionar todos
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
FiltroCliente.Hide
FLancamento.TextBox1.Value = FiltroCliente.ListBox1.List(ListBox1.ListIndex, 0)
FLancamento.TextBox2.Value = FiltroCliente.ListBox1.List(ListBox1.ListIndex, 1)
FLancamento.Show
FLancamento.TextBox1.SetFocus
End Sub
Códigos baseados na sua planilha, aqui rodou e entregou o que pediu.
Qualquer dúvida só postar novamente.
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