Galera,
Tô no maior sofrimento com esse tal de LISTVIEW. Terminei essa planilha (em anexo) que por sinal ficou muito boa, só que quando instalo em outros computadores, devido ao LISTVIEW a planilha não roda. Diante desse impasse, gostaria que alguém me ajudasse a mudar esse código abaixo de LISTVIEW para LISTBOX ??
Agradeceria muito se vocês fizessem isso pra mim.
Private Sub ListView1_DblClick()
On Error GoTo Erro
Dim BUSCAR_ENDEREÇO As Variant
BUSCAR_ENDEREÇO = ListView1.SelectedItem
Planilha3.Select
Dim G As UserForm1
Set G = UserForm1
With Worksheets("banco de Dados").Range("a:a")
Set c = .Find(BUSCAR_ENDEREÇO, LookIn:=xlValues, LookAt:=xlPart)
If Not c Is Nothing Then
c.Activate
G.TextBox41.Value = c.Value
G.TextBox15.Value = c.Offset(0, 1).Value
G.ComboBox1.Value = c.Offset(0, 2).Value
G.ComboBox2.Value = c.Offset(0, 3).Value
G.txtData.Value = c.Offset(0, 4).Value
G.TextBox35.Value = c.Offset(0, 5).Value
G.TextBox34.Value = c.Offset(0, 6).Value
G.TextBox2.Value = c.Offset(0, 7).Value
G.TextBox5.Value = c.Offset(0, 8).Value
G.TextBox43.Value = c.Offset(0, 9).Value
G.ComboBox11.Value = c.Offset(0, 10).Value
G.TextBox42.Value = c.Offset(0, 11).Value
G.TextBox40.Value = c.Offset(0, 12).Value
G.ComboBox4.Value = c.Offset(0, 13).Value
G.ComboBox9.Value = c.Offset(0, 14).Value
G.ComboBox10.Value = c.Offset(0, 15).Value
G.ComboBox8.Value = c.Offset(0, 16).Value
G.ComboBox5.Value = c.Offset(0, 17).Value
G.ComboBox12.Value = c.Offset(0, 18).Value
G.ComboBox13.Value = c.Offset(0, 19).Value
G.ComboBox14.Value = c.Offset(0, 20).Value
G.txtData1.Value = c.Offset(0, 21).Value
G.TextBox29.Value = c.Offset(0, 22).Value
G.TextBox18.Value = c.Offset(0, 23).Value
G.TextBox19.Value = c.Offset(0, 24).Value
G.TextBox20.Value = c.Offset(0, 25).Value
G.ComboBox7.Value = c.Offset(0, 26).Value
G.ComboBox15.Value = c.Offset(0, 27).Value
G.ComboBox16.Value = c.Offset(0, 28).Value
G.ComboBox3.Value = c.Offset(0, 29).Value
G.ComboBox6.Value = c.Offset(0, 30).Value
G.ComboBox17.Value = c.Offset(0, 31).Value
Unload Me
End If
End With
Exit Sub
Erro:
MsgBox "Erro!!!", vbCritical, "BUSCA"
End Sub
Private Sub TextBox1_Change()
Dim c As Range
Dim ws As Worksheet
Dim FirstAddress As String
If Me.TextBox1 = "" Then
'Call atualizar2
Me.Label2.Caption = Format(ListView1.ListItems.Count, "0")
Else
Set ws = Worksheets("Banco de Dados")
Me.ListView1.ListItems.Clear
With ws
Set c = .Columns(1).Find(Me.TextBox1.Value, LookIn:=xlValues)
If Not c Is Nothing Then
FirstAddress = c.Address
Do
Set li = ListView1.ListItems.Add(Text:=c.Value)
li.ListSubItems.Add Text:=VBA.Format(c.Offset(, 1).Value, "0")
Set c = .Columns(1).FindNext(c)
Loop While Not c Is Nothing And c.Address <> FirstAddress
End If
End With
End If
Me.Label2.Caption = Format(ListView1.ListItems.Count, "0")
End Sub
Private Sub UserForm_Initialize()
Sheets("Banco de Dados").Select
With ListView1
.Gridlines = True
.View = lvwReport
.FullRowSelect = True
'.ColumnHeaders.Add Text:="Procedimento", Width:=60
'.ColumnHeaders.Add Text:="Data da Queima", Width:=60
'.ColumnHeaders.Add Text:="Nº da OS", Width:=60
'.ColumnHeaders.Add Text:="Resp. p/ Preenchimento", Width:=60
'.ColumnHeaders.Add Text:="Número/Nome da Equipe", Width:=60
'.ColumnHeaders.Add Text:="Nº da Plaqueta", Width:=60
'.ColumnHeaders.Add Text:="Total de Clientes", Width:=60
.ColumnHeaders.Add Text:="Nº de Série", Width:=60
.ColumnHeaders.Add Text:="Endereço", Width:=140
'.ColumnHeaders.Add Text:="Cidade", Width:=60
'.ColumnHeaders.Add Text:="Propriedade", Width:=60
'.ColumnHeaders.Add Text:="Marca", Width:=60
'.ColumnHeaders.Add Text:="Nº de Série", Width:=60
'.ColumnHeaders.Add Text:="Mês/Ano Fabricação", Width:=60
'.ColumnHeaders.Add Text:="Potência", Width:=60
'.ColumnHeaders.Add Text:="Tensão Pri.", Width:=60
'.ColumnHeaders.Add Text:="Tensão Sec.", Width:=60
'.ColumnHeaders.Add Text:="Lig. Prim.", Width:=60
'.ColumnHeaders.Add Text:="Elo Fusível", Width:=60
'.ColumnHeaders.Add Text:="Para-raio", Width:=60
'.ColumnHeaders.Add Text:="Proteção Sec.", Width:=60
'.ColumnHeaders.Add Text:="Causa", Width:=60
'.ColumnHeaders.Add Text:="Data Instalação", Width:=60
'.ColumnHeaders.Add Text:="Nº da OS de Inst.", Width:=60
'.ColumnHeaders.Add Text:="Nº de Serie", Width:=60
'.ColumnHeaders.Add Text:="Marca", Width:=60
'.ColumnHeaders.Add Text:="Mês/Ano Fabric.", Width:=60
'.ColumnHeaders.Add Text:="Potência", Width:=60
'.ColumnHeaders.Add Text:="Tensão Prim.", Width:=60
'.ColumnHeaders.Add Text:="Tensão Sec.", Width:=60
'.ColumnHeaders.Add Text:="Lig. Prim.", Width:=60
'.ColumnHeaders.Add Text:="Elo Fusível", Width:=75, Alignment:=2
End With
ListView1.ListItems.Clear
lin = 2
Range("A2").Select
While ActiveCell <> ""
Set linha = ListView1.ListItems.Add(Text:=Sheets("Banco de Dados").Cells(lin, 1).Value)
linha.ListSubItems.Add Text:=Sheets("Banco de Dados").Cells(lin, 2).Value
'linha.ListSubItems.Add Text:=Sheets("Banco de Dados").Cells(lin, 3).Value
'linha.ListSubItems.Add Text:=Sheets("Banco de Dados").Cells(lin, 4).Value
'linha.ListSubItems.Add Text:=Sheets("Banco de Dados").Cells(lin, 5).Value
'linha.ListSubItems.Add Text:=Sheets("Banco de Dados").Cells(lin, 6).Value
'linha.ListSubItems.Add Text:=Sheets("Banco de Dados").Cells(lin, 7).Value
'linha.ListSubItems.Add Text:=Sheets("Banco de Dados").Cells(lin, 8).Value
'linha.ListSubItems.Add Text:=Sheets("Banco de Dados").Cells(lin, 9).Value
'linha.ListSubItems.Add Text:=Sheets("Banco de Dados").Cells(lin, 10).Value
'linha.ListSubItems.Add Text:=Sheets("Banco de Dados").Cells(lin, 11).Value
'linha.ListSubItems.Add Text:=Sheets("Banco de Dados").Cells(lin, 12).Value
'linha.ListSubItems.Add Text:=Sheets("Banco de Dados").Cells(lin, 13).Value
'linha.ListSubItems.Add Text:=Sheets("Banco de Dados").Cells(lin, 14).Value
'linha.ListSubItems.Add Text:=Sheets("Banco de Dados").Cells(lin, 15).Value
'linha.ListSubItems.Add Text:=Sheets("Banco de Dados").Cells(lin, 16).Value
'linha.ListSubItems.Add Text:=Sheets("Banco de Dados").Cells(lin, 17).Value
'linha.ListSubItems.Add Text:=Sheets("Banco de Dados").Cells(lin, 18).Value
'linha.ListSubItems.Add Text:=Sheets("Banco de Dados").Cells(lin, 19).Value
'linha.ListSubItems.Add Text:=Sheets("Banco de Dados").Cells(lin, 20).Value
'linha.ListSubItems.Add Text:=Sheets("Banco de Dados").Cells(lin, 21).Value
'linha.ListSubItems.Add Text:=Sheets("Banco de Dados").Cells(lin, 22).Value
'linha.ListSubItems.Add Text:=Sheets("Banco de Dados").Cells(lin, 23).Value
'linha.ListSubItems.Add Text:=Sheets("Banco de Dados").Cells(lin, 24).Value
'linha.ListSubItems.Add Text:=Sheets("Banco de Dados").Cells(lin, 25).Value
'linha.ListSubItems.Add Text:=Sheets("Banco de Dados").Cells(lin, 26).Value
'linha.ListSubItems.Add Text:=Sheets("Banco de Dados").Cells(lin, 27).Value
'linha.ListSubItems.Add Text:=Sheets("Banco de Dados").Cells(lin, 28).Value
'linha.ListSubItems.Add Text:=Sheets("Banco de Dados").Cells(lin, 29).Value
'linha.ListSubItems.Add Text:=Sheets("Banco de Dados").Cells(lin, 30).Value
'linha.ListSubItems.Add Text:=Sheets("Banco de Dados").Cells(lin, 31).Value
lin = lin + 1
ActiveCell.Offset(1, 0).Activate
Wend
End Sub
De já meus agradecimentos.
Paulo Cezar.
Vídeo recomendado
https://youtu.be/diWPPPhW-9E
https://youtu.be/diWPPPhW-9E
De LISTVIEW para LISTBOX
-
- Acabou de chegar
- Mensagens: 2
- Registrado em: Qui Jan 12, 2017 11:56 am
De LISTVIEW para LISTBOX
- Anexos
-
- Cadastramento de TRAFOS Substituidos.zip
- (664.46 KiB) Baixado 529 vezes