Jump to content
Fórum Script Brasil
  • 0

Minha macro roda mas não executa as tarefas, help!!!


Question

A intenção era criar uma macro para, dependendo do nome colocado na célula, preencher com o respectivo sobrenome. Ela está rodando sem dar erro mas não executa função nenhuma... 

Se souberem o erro, por favor, me ajudem a corrigi-lo

Private Sub Worksheet_Change(ByVal Target As Range)

Dim w   As Worksheet

Set w = Sheets("Planilha1")


w.Select
w.Range("a1").Select


Do While ActiveCell <> ""

        If ActiveCell.Value = "camila" Then
    
            ActiveCell.Offset(1, 0).Select
            ActiveCell.Value = faleiros
            ActiveCell.Offset(-1, 1).Select
            
            Else
            ActiveCell.Offset(0, 1).Select
            
            End If
            
            
        If ActiveCell.Value = "marina" Then
            
            ActiveCell.Offset(1, 0).Select
            ActiveCell.Value = alves
            ActiveCell.Offset(-1, 1).Select
            
            Else
            ActiveCell.Offset(0, 1).Select
            
            End If


        If ActiveCell.Value = "alexandra" Then
            
            ActiveCell.Offset(1, 0).Select
            ActiveCell.Value = pereira
            ActiveCell.Offset(-1, 1).Select
            
            Else
            ActiveCell.Offset(0, 1).Select
            
            End If

Loop

End Sub

Link to post
Share on other sites

1 answer to this question

Recommended Posts

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
      149422
    • Total Posts
      645925
×
×
  • Create New...