- 10 Ago 2018 às 13:54
#35689
Boa tarde à todos!
Ontem pedi ajuda para resolver um problema que estava tendo em uma listbox, cujo o mesmo era:
alterar um valor de acordo com o um double click na listbox. Fui ajudado e realmente funcionou, porém hoje
percebi que preciso de realizar o mesmo comando, porém selecionando mais de uma linha na listbox.
Tentei usar listbox1.Selected , listbox1.Multiselect,
só que nenhum desses comandos estão resolvendo meu problema.
Seria possível uma ajuda?
Segue o código e planilha em anexo
Obrigado
Private Sub CommandButton1_Click()
Editar = ListBox1.ListIndex
COD = ListBox1.List(Editar, 0)
VERIFICAR = ListBox1.List(Editar, 17)
resp = MsgBox("Confirmar?", vbYesNo, "")
If resp = vbYes Then
Sheets("joao").Select
Range("b3").Select
Do
If ActiveCell.Value = COD Then
ActiveCell.Select
ActiveCell.Offset(0, 17).Select
If VERIFICAR = "NÃO PAGO" Then
ActiveCell.Value = "PAGO"
ListBox1.List(Editar, 17) = "PAGO"
Else
ActiveCell.Value = "NÃO PAGO"
ListBox1.List(Editar, 17) = "NÃO PAGO"
End If
Exit Sub
End If
If ActiveCell.Value = "" Then
Exit Sub
End If
ActiveCell.Offset(1, 0).Select
Loop
Else
Exit Sub
End If
End Sub
Ontem pedi ajuda para resolver um problema que estava tendo em uma listbox, cujo o mesmo era:
alterar um valor de acordo com o um double click na listbox. Fui ajudado e realmente funcionou, porém hoje
percebi que preciso de realizar o mesmo comando, porém selecionando mais de uma linha na listbox.
Tentei usar listbox1.Selected , listbox1.Multiselect,
só que nenhum desses comandos estão resolvendo meu problema.
Seria possível uma ajuda?
Segue o código e planilha em anexo
Obrigado
Private Sub CommandButton1_Click()
Editar = ListBox1.ListIndex
COD = ListBox1.List(Editar, 0)
VERIFICAR = ListBox1.List(Editar, 17)
resp = MsgBox("Confirmar?", vbYesNo, "")
If resp = vbYes Then
Sheets("joao").Select
Range("b3").Select
Do
If ActiveCell.Value = COD Then
ActiveCell.Select
ActiveCell.Offset(0, 17).Select
If VERIFICAR = "NÃO PAGO" Then
ActiveCell.Value = "PAGO"
ListBox1.List(Editar, 17) = "PAGO"
Else
ActiveCell.Value = "NÃO PAGO"
ListBox1.List(Editar, 17) = "NÃO PAGO"
End If
Exit Sub
End If
If ActiveCell.Value = "" Then
Exit Sub
End If
ActiveCell.Offset(1, 0).Select
Loop
Else
Exit Sub
End If
End Sub
Você não está autorizado a ver ou baixar esse anexo.