I'm coming to you to ask for some help with this code :
Firstly : The code works but...
Secondly, the goal of this worksheet is to be able to copy the values of cells "C", "G" and "I" contained in Chequing account table
into the next available line of the Savings account table in columns "Q", "S" and "W".
Thirdly, Vice versa, I need the values of cells "Q", "S" and "U" of Savings account table into the next available line of the Chequing account table in columns "C", "G" and "K".
I attached the file for a better understanding.
Thank you very much for your help,
Camaalot
Code:
Option Explicit
Dim lgn&
Dim plage1 As Range, plage2 As Range
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
lgn = Target.Row
Set plage1 = Range("C" & lgn & ",E" & lgn & ",G" & lgn & ",I" & lgn & ",K" & lgn & ",M" & lgn)
Set plage2 = Range("Q" & lgn & ",S" & lgn & ",U" & lgn & ",W" & lgn & ",Y" & lgn)
plage2.Select
If Not Intersect(Target, Union(plage1, plage2)) Is Nothing Then
If Target.Column < 14 And UCase(Range("G" & lgn)) = UCase("Chequing to Savings transfer") Then
Range("Q" & Target.Row) = Range("C" & Target.Row)
Range("S" & Target.Row) = Range("G" & Target.Row)
Range("W" & Target.Row) = Range("i" & Target.Row)
ElseIf Target.Column > 14 And (UCase(Range("S" & lgn)) = UCase("Chequing to Savings transfer") _
Or UCase(Range("S" & lgn)) = UCase("Savings to chequing transfer")) Then
Range("C" & Target.Row) = Range("Q" & Target.Row)
Range("G" & Target.Row) = Range("S" & Target.Row)
Range("K" & Target.Row) = Range("U" & Target.Row)
End If
End If
Application.EnableEvents = True
End Sub
Sub Evenement()
Application.EnableEvents = True
End Sub
Firstly : The code works but...
Secondly, the goal of this worksheet is to be able to copy the values of cells "C", "G" and "I" contained in Chequing account table
into the next available line of the Savings account table in columns "Q", "S" and "W".
Thirdly, Vice versa, I need the values of cells "Q", "S" and "U" of Savings account table into the next available line of the Chequing account table in columns "C", "G" and "K".
I attached the file for a better understanding.
Thank you very much for your help,
Camaalot