Notifications
Clear all

Excluir Nome ListBox e Planilha

3 Posts
2 Usuários
0 Reactions
767 Visualizações
(@miguel-70)
Posts: 0
New Member
Topic starter
 

Óla boa tarde,
Como faço, eu click em um dos nome do ListBox e excluir este nome do ListBox e automaticamente da Planilha?
Tenho um modelo em anexo para melhor entendimento.
Obrigado.

 
Postado : 21/08/2015 12:20 pm
(@issamu)
Posts: 0
New Member
 

Olá!
Há muitas maneiras de fazer.
Baseado no seu arquivo, você pode modificar o evento CommandButton1_Click com o código:

Private Sub CommandButton1_Click()

Application.ScreenUpdating = False
Plan1.Visible = xlSheetVisible
Plan1.Activate

 Cells.Find(What:=ListBox1.Value, After:=ActiveCell, LookIn:=xlFormulas, _
        LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
        MatchCase:=False, SearchFormat:=False).Activate
    Selection.Delete Shift:=xlUp

ListBox1.Clear
Me.ListBox1.List = Application.WorksheetFunction.Transpose(Plan1.Range("A9:A200"))

Plan1.Visible = xlSheetHidden
Application.ScreenUpdating = True

End Sub
 
Postado : 21/08/2015 12:36 pm
(@miguel-70)
Posts: 0
New Member
Topic starter
 

Ótimo amigo, obrigado. Resolvido.

 
Postado : 21/08/2015 12:50 pm