Ir para conteúdo
Fórum Script Brasil
  • 0

Erro Na diferença do nome da celula com o nome Encontrato


andrecoutinhoalb@gmail.com

Pergunta

Olá a todos.

 

Eu tentei criar um código para deletar um uma determinada quantidade de linhas na condição de me voltar o nome perguntado.

Ela roda até certo ponto.

Se apertar ESC ela cancela.

Se não digitar nada ela funciona.

Se digitar o nome correto ela funciona e dela.

Mas...

Se digitar qualquer outro nome diferente do procurado da erro.

Segue codigo abaixo:

 

Sub DELETARFUNCIONARIO()

Application.ScreenUpdating = False
ActiveSheet.Unprotect

showInputBox:
    
    Resp = Application.InputBox("Digite o nome do funcionário para excluir", "EXCLUIR")
    Cont = Range("AJ16:AT200").Select
    
    If Resp = False Then
        MsgBox "Operação cancelada!"
        
        End
    Else
    
    If Resp = Empty Then
            MsgBox "Campo Vazio. É necessário digitar um nome!"
            
              GoTo showInputBox
   
End If
End If

Range("AJ16:AT200").Select
Cells.Find(What:=Resp).Activate
Lin = ActiveCell.Row
Rows(Lin).Select
Selection.EntireRow.Delete Shift:=x1up

Range("AJ16:AT200").Select
Cells.Find(What:=Resp).Activate
Lin = ActiveCell.Row
Rows(Lin).Select
Selection.EntireRow.Delete Shift:=x1up

Range("AJ16:AT200").Select
Cells.Find(What:=Resp).Activate
Lin = ActiveCell.Row
Rows(Lin).Select
Selection.EntireRow.Delete Shift:=x1up

Range("AJ16:AT200").Select
Cells.Find(What:=Resp).Activate
Lin = ActiveCell.Row
Rows(Lin).Select
Selection.EntireRow.Delete Shift:=x1up

Range("AJ16:AT200").Select
Cells.Find(What:=Resp).Activate
Lin = ActiveCell.Row
Rows(Lin).Select
Selection.EntireRow.Delete Shift:=x1up

Range("AJ16:AT200").Select
Cells.Find(What:=Resp).Activate
Lin = ActiveCell.Row
Rows(Lin).Select
Selection.EntireRow.Delete Shift:=x1up

Range("AJ16:AT200").Select
Cells.Find(What:=Resp).Activate
Lin = ActiveCell.Row
Rows(Lin).Select
Selection.EntireRow.Delete Shift:=x1up

Range("AJ16:AT200").Select
Cells.Find(What:=Resp).Activate
Lin = ActiveCell.Row
Rows(Lin).Select
Selection.EntireRow.Delete Shift:=x1up

Range("AJ16:AT200").Select
Cells.Find(What:=Resp).Activate
Lin = ActiveCell.Row
Rows(Lin).Select
Selection.EntireRow.Delete Shift:=x1up


 Cells.FormatConditions.Delete

    'Mostrar Menu
    Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"
    'Barra de Fórmulas
    Application.DisplayFormulaBar = False
    'Barra de Status
    Application.DisplayStatusBar = False
    'Cabeçalhos
    ActiveWindow.DisplayHeadings = False
    'Guias de planilhas
    ActiveWindow.DisplayWorkbookTabs = False
    'Linhas de grade
    ActiveWindow.DisplayGridlines = False

    Call ALERTA
    Call COLORPASSAGEM
    Call ATRASADO
    Call COLORPAGOINTERNO
    Call NEUTRO1
    Call NEUTRO
    Call CMVCOLORGREEN
    Call CMVCOLORRED
    Call COLORSTATUSGREEN
    Call COLORSTATUSRED
    Call SELECAO
    Call PAGO

ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, AllowSorting:=True, AllowFiltering:=True
ActiveSheet.EnableSelection = xlUnlockedCells
Range("AJ16").Select


End Sub

Link para o comentário
Compartilhar em outros sites

0 respostass a esta questão

Posts Recomendados

Até agora não há respostas para essa pergunta

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,1k
    • Posts
      651,8k
×
×
  • Criar Novo...