Boa noite
tenho estes dois códigos em esta pasta de trabalho e eles funcionam perfeitamente, mas precisei inserir o terceiro código mas ele dá erro por ter uma linha em ambos os códigos que estão com o mesmo nome.
os dois abaixo são os que já estavam na planilha e funcionam perfeito
Option Explicit
Private Sub Workbook_Open()
ActiveWindow.DisplayWorkbookTabs = False ' Oculta o Diiplay c/ os nomes das abas, ao abrir
End Sub
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim LR As Long, X As String
If Target.Count > 1 Then Exit Sub
If Target.Column = 10 And Target.Value = "A" Then X = "Itau - Alimenta"
If Target.Column = 10 And Target.Value = "G" Then X = "BRADESCO - Golden"
If X <> vbNullString Then
With Sheets(X)
LR = .Cells(4501, 1).End(3).Row
On Error GoTo res
Application.EnableEvents = False
.Cells(LR + 1, 1).Resize(, 5).Value = Cells(Target.Row, 2).Resize(, 5).Value
.Cells(LR + 1, = Cells(Target.Row, 9)
.Cells(LR + 1, 10).Resize(, 2).Value = Cells(Target.Row, 11).Resize(, 2).Value
res:
Application.EnableEvents = True
End With
End If
End Sub
MAS QUANDO COLOCO ESTE ABAIXO, DÁ ERRO, PORQUE AMBOS POSSUEM O MESMO NOME
ENTEI COLOCAR um ponto EM UM DELES MAS NÃO RESOLVEU.
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim UL As Long
If Sh.Name = "Itau - Alimenta" Or Target.Count > 1 Then Exit Sub
If Target.Column <> 10 Or Target.Value <> "C" Then Exit Sub
Application.ScreenUpdating = False
With Sheets("Itau - Alimenta")
UL = .Cells(4500, 1).End(xlUp).Row
Cells(Target.Row, 2).Resize(, 5).Copy .Cells(UL + 1, 1)
Cells(Target.Row, 8).Resize(, 5).Copy .Cells(UL + 1, 7)
End With
End Sub
Alguém poderia me ajudar a corrigir este erro?