Boa tarde pessoal,
Necessito de uma ajuda,
tenho um plan com dados em colunas e preciso que a listbox seja carregada em linhas.
Segue anexo a planilha com mais detalhes
Desde já agradeço
Vídeo recomendado
https://youtu.be/diWPPPhW-9E
https://youtu.be/diWPPPhW-9E
[RESOLVIDO] ListBox-Carregar linhas com dados das colunas
[RESOLVIDO] ListBox-Carregar linhas com dados das colunas
- Anexos
-
- LISTBOX - CARREGAR LINHAS COM DADOS DAS COLUNAS.rar
- (21.45 KiB) Baixado 272 vezes
Editado pela última vez por milton em Sex Set 21, 2018 2:15 pm, em um total de 1 vez.
- Reinaldo
- Jedi
- Mensagens: 1537
- Registrado em: Sex Ago 01, 2014 4:09 pm
- Localização: Garça - SP / SCS - SP
Re: LISTBOX - CARREGAR LINHAS COM DADOS DAS COLUNAS
Experimente:
Código: Selecionar todos
Private Sub CommandButton1_Click()
Dim linha As Integer
Dim linhalistbox As Integer
ListBox1.Clear
linhalistbox = 0 'local 0 linha dentro da listbox
ListBox1.ColumnCount = 5
ListBox1.ColumnWidths = "18;195;110;30;35"
linha = 2
Sheets("ORCAMENTOREL").Select
Range("A" & linha).Select
Do While Range("A" & linha) <> ""
If Plan1.Range("A" & linha) = Me.CbbId Then
'Ao localizar a buscda do Id na Planilha, carrega a listbox
For x = 1 To 60 Step 5
'Codigo para carregar a listbox
ListBox1.AddItem Sheets("ORCAMENTOREL").Cells(linha, x + 1).Value
ListBox1.List(ListBox1.ListCount - 1, 1) = Sheets("ORCAMENTOREL").Cells(linha, x + 2).Value
ListBox1.List(ListBox1.ListCount - 1, 2) = Sheets("ORCAMENTOREL").Cells(linha, x + 3).Value
ListBox1.List(ListBox1.ListCount - 1, 3) = Sheets("ORCAMENTOREL").Cells(linha, x + 4).Value
ListBox1.List(ListBox1.ListCount - 1, 4) = Format(Sheets("ORCAMENTOREL").Cells(linha, x + 5).Value, "R$ " & "#,##0.00")
Next
End If
linha = linha + 1
Loop
End Sub
Re: LISTBOX - Carregar linhas com dados das colunas
Reinaldo boa tarde!
Perfeito, era exatamente isso.
Muito obrigado!!!
Perfeito, era exatamente isso.
Muito obrigado!!!