f_oberdorfer
14-08-2015 12:57:12
Bom dia... estou tendo o erro "Não foi possível obter a propriedade List. Índice de matriz de propriedade inválido" no código abaixo, como posso resolver isso?
A linha onde há o erro está indicada como "<---------erro"
'**************************************************************
Private Sub ListBox1_Click()
If Me.ListBox1.ListCount = 0 Then
Else
Dim Item As Double
Dim linha As Integer
Dim valor_unitario As Double
Dim valor_total As Double
Range("A2").Select
linha = 2
For Item = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(Item) = True Then
TextBox2 = ListBox1.List(Item, 3)
TextBox3 = ListBox1.List(Item, 4)
CommandButton1.Enabled = True
End If
Next
Do While Cells(linha, 1) <> "ultCel"
If Cells(linha, 1) = ListBox1.List(Item, 0).Text Then '<---------------------------erro
If ActiveCell.Offset(0, 3) = TextBox2.Text Then
If ActiveCell.Offset(0, 5) = TextBox3.Text Then
ActiveCell.Offset(0, 3).Select
ActiveCell = ActiveCell.Value - TextBox4.Value
quant = ActiveCell.Value
CARREGALIST
TextBox2 = quant
Exit Do
End If
End If
End If
linha = linha + 1
Loop
End If
End Sub
'**************************************************************
A linha onde há o erro está indicada como "<---------erro"
'**************************************************************
Private Sub ListBox1_Click()
If Me.ListBox1.ListCount = 0 Then
Else
Dim Item As Double
Dim linha As Integer
Dim valor_unitario As Double
Dim valor_total As Double
Range("A2").Select
linha = 2
For Item = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(Item) = True Then
TextBox2 = ListBox1.List(Item, 3)
TextBox3 = ListBox1.List(Item, 4)
CommandButton1.Enabled = True
End If
Next
Do While Cells(linha, 1) <> "ultCel"
If Cells(linha, 1) = ListBox1.List(Item, 0).Text Then '<---------------------------erro
If ActiveCell.Offset(0, 3) = TextBox2.Text Then
If ActiveCell.Offset(0, 5) = TextBox3.Text Then
ActiveCell.Offset(0, 3).Select
ActiveCell = ActiveCell.Value - TextBox4.Value
quant = ActiveCell.Value
CARREGALIST
TextBox2 = quant
Exit Do
End If
End If
End If
linha = linha + 1
Loop
End If
End Sub
'**************************************************************