- 22 Fev 2023 às 17:53
#72993
Passei o dia inteiro hoje tentando ativar o código Excluir no userforms e não consegui finalizar, ele dá todas as mensagens mas NÃO ESCLUI A LINHA BUSCADA, não consegui achar uma varíável. veja os códigos abaixo, preciso enviar o arquivo tambem para facilitar o entendimento?
Private Sub BtExcluirCad_Click()
On Erro GoTo Erro
Plan6.Activate
Dim plan As String
plan = Plan6.Name
Dim confirmar As String
confirmar = MsgBox("Deseja realmente EXCLUIR este registro?", vbYesNo, "EXCLUIR")
If confirmar = vbNo Then
MsgBox "Exclusao cancelada!", vbInformation, "EXCLUIR"
Exit Sub
End If
Dim c
With Worksheets(plan).Range("A:A")
Set c = .Find(resp, LookIn:=xlValues, lookat:=xlWhole)
If Not c Is Nothing Then
c.Activate
Selection.EntireRow.Delete
MsgBox "Exclusao efetuada com sucesso!", vbInformation, "EXCLUIR"
Else
End If
End With
Exit Sub
Erro:
MsgBox "Erro!", vbCritical, "ERRO"
End Sub
Private Sub BtExcluirCad_Click()
On Erro GoTo Erro
Plan6.Activate
Dim plan As String
plan = Plan6.Name
Dim confirmar As String
confirmar = MsgBox("Deseja realmente EXCLUIR este registro?", vbYesNo, "EXCLUIR")
If confirmar = vbNo Then
MsgBox "Exclusao cancelada!", vbInformation, "EXCLUIR"
Exit Sub
End If
Dim c
With Worksheets(plan).Range("A:A")
Set c = .Find(resp, LookIn:=xlValues, lookat:=xlWhole)
If Not c Is Nothing Then
c.Activate
Selection.EntireRow.Delete
MsgBox "Exclusao efetuada com sucesso!", vbInformation, "EXCLUIR"
Else
End If
End With
Exit Sub
Erro:
MsgBox "Erro!", vbCritical, "ERRO"
End Sub