Notifications
Clear all

listbox com filtro ativo, colocar dados em uma textbox

3 Posts
2 Usuários
0 Reactions
884 Visualizações
(@sco0f)
Posts: 0
New Member
Topic starter
 

e o seguinte galera, tenho um userform que tem uma listbox com filtro, quando faço o filtro e clico no objeto que eu quero que vai para as textbox. por ex:
cod
1
2
3
4
5
se eu filtrar o numero 5 , somente ele vai aparecer na listbox, mais quando eu clicar nele, aparece na textbox o valor 1, entenderam ?

CODIGO

Private Sub ListBoxLista_Click()
Sheets("impressora").Select

Dim Employee As Variant
Dim Name As String
Dim firstaddress As String

Employee = Empty
'SE PRECISAR MAIS DE 500 LINHAS É SÓ ALTERAR ABAIXO
With ActiveSheet.Range("a1:a3000")
Name = ListBoxLista.Value
Set Employee = .Find(What:=Name, LookIn:=xlValues)
If Not Employee Is Nothing Then Employee.Rows.EntireRow.Select Else Exit Sub
End With
'FECHA O FORM QUANDO CLICA NO NOME
'Unload Me
Set Employee = Nothing

linha = Me.ListBoxLista.ListIndex + 1 'Carregar os valores cadastrados no listbox'
Me.TextBox1.Value = Range("codg").Item(linha)
Me.TextBox2.Value = Range("cod").Item(linha)
Me.TextBox3.Value = Range("aparelho").Item(linha)
Me.TextBox4.Value = Range("marca").Item(linha)
Me.TextBox5.Value = Range("defeito").Item(linha)
Me.TextBox6.Value = Range("obs").Item(linha)
Me.TextBox7.Value = Range("nº").Item(linha)
Me.TextBox8.Value = Range("modelo").Item(linha)
Me.TextBox9.Value = Range("valor").Item(linha)
Me.TextBox10.Value = Range("data").Item(linha)

ESSE CODGO FUNCIONA SE NÃO TIVER FILTRO ATIVO, MAIS SE ATIVAR ELE NÃO FUNCIONA

 
Postado : 12/06/2014 7:54 pm
(@sco0f)
Posts: 0
New Member
Topic starter
 

Alguem ai pra dar uma luz ?

 
Postado : 13/06/2014 7:40 am
(@fernandofernandes)
Posts: 43750
Illustrious Member
 

Boa tarde!!

Eu não compreendi muito bem....

Poste seu arquivo modelo!!

Att

 
Postado : 13/06/2014 12:20 pm