Notifications
Clear all

Como carregar uma lista em uma listbox de um form?

3 Posts
2 Usuários
0 Reactions
756 Visualizações
(@wolneypk)
Posts: 188
Reputable Member
Topic starter
 

Senhores, é o seguinte:

Tenho uma planilha com os seguintes nomes um em baixo do outro:

Maria
José
Carlos
Pedro
Antonio

Quero criar um form e colocar uma ListBox lá e quero que ao acionar essa listbox, ela me mostre esses nomes que estão lá na Plan1.
Como faço isso?

 
Postado : 18/12/2012 11:30 am
(@fernandofernandes)
Posts: 43750
Illustrious Member
 

Boa tarde!!
Tente

Sub Tente()
Dim shtList As Worksheet
Dim cell, rng As Range
Dim nRow As Integer

Set shtList = ThisWorkbook.Worksheets(Sheets.Count)
nRow = shtList.Cells(1, 1).End(xlDown).Row

With ListForm.ListBox
    .Clear
    .ColumnCount = 2
    .List = Range(Cells(1, 1), Cells(nRow, 2)).Value
End With

ListForm.Show

End Sub

Use a pesquisa do fórum.
search.php?keywords=Como+carregar+uma+lista+em+uma+listbox+de+um+form&terms=all&author=&sv=0&sc=1&sf=all&sr=posts&sk=t&sd=d&st=0&ch=300&t=0&submit=Pesquisar

Talvez outra forma

Private Sub UserForm_Initialize()
Plan1.Range("A1", Plan1.Range("A65536").End(xlUp)).Name = "AleVBA"
ListBox1.RowSource = "AleVBA"
End Sub

Att

 
Postado : 18/12/2012 11:34 am
(@wolneypk)
Posts: 188
Reputable Member
Topic starter
 

Perfeito Alexandre!
Muito Obrigado amigo pela força de sempre!

 
Postado : 13/03/2013 9:00 am