Bom dia
A macro abaixo foi desenvolvida pelo McJota, aqui do fórum em 27 de outubro e atende 100% minha necessidade. Um outro post aqui do fórum, faz um pedido de ajuda com macro semelhante pelo santa.ars, e prontamente atendido. Então queria saber do alexandrevba se tem como implementar essa parte do código do santa.ars, na macro do McJota:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("C1")) Is Nothing Or Target.Cells.Count > 1 Then
Exit Sub
Else
Call SuaMacro
End If
End Sub
Para que rodasse a macro do McJota, sem a necessidade do botão executar e em caso positivo, onde seria a inserção da macro do McJota.
Macro do McJota
Sub Valor()
Dim y As String
Dim x As Range
Dim j As Range
On Error GoTo erro
Application.EnableEvents = False
ActiveCell.Offset(0, -1).Select
Set x = ActiveCell
y = ActiveCell.Value
ThisWorkbook.Worksheets("Plan2").Activate
With Sheets("Plan2").Range("S1:S10")
Set c = .Find(y, Lookat:=xlWhole)
If Not c Is Nothing Then
c.Select
Set j = ActiveCell
Range("U" & j, "AD" & j).Select
Selection.Copy
ThisWorkbook.Worksheets("Plan1").Activate
ActiveCell.Offset(0, 3).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveCell.Offset(0, -3).Select
Application.EnableEvents = True
End If
End With
erro:
Exit Sub
End Sub