Jump to content
Fórum Script Brasil
  • 0

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


Question

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 to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      148692
    • Total Posts
      644525
×
×
  • Create New...