Results 1 to 5 of 5

VBA to transfer values to one table to another

Threaded View

  1. #1
    Registered User
    Join Date
    01-25-2018
    Location
    Quebec, Canada
    MS-Off Ver
    2013
    Posts
    16

    VBA to transfer values to one table to another

    Hi,

    I have some problem with this VBA code that is use to transfer values from one table to another.

    Option Explicit
    
    Private Sub Worksheet_Change(ByVal Target As Range)
        Dim chqLR As Long, savLR As Long, celLR As Long, marLR As Long
        
        
    If Target.Row < 6 Or Target.Row > 102 Then Exit Sub
    If Target.Column <> 7 And Target.Column <> 9 And Target.Column <> 19 And Target.Column <> 21 Then Exit Sub
    
    Application.EnableEvents = False
    
    chqLR = Range("C" & 102).End(xlUp).Row
    savLR = Range("Q" & 102).End(xlUp).Row
    celLR = Range("AC" & 102).End(xlUp).Row
    marLR = Range("AO" & 102).End(xlUp).Row
        
    If Target.Column = 7 Or Target.Column = 9 Then
        If UCase(Range("G" & Target.Row)) = UCase("Transfer Chequing-Savings") _
           And Range("I" & Target.Row) <> "" Then
                Range("Q" & savLR + 1) = Range("C" & Target.Row)
                Range("S" & savLR + 1) = Range("G" & Target.Row)
                Range("W" & savLR + 1) = Range("i" & Target.Row)
        End If
    End If
    
    If Target.Column = 19 Or Target.Column = 21 Then
        If UCase(Range("S" & Target.Row)) = UCase("Transfer Savings-Chequing") _
           And Range("U" & Target.Row) <> "" Then
                Range("C" & chqLR + 1) = Range("Q" & Target.Row)
                Range("G" & chqLR + 1) = Range("S" & Target.Row)
                Range("K" & chqLR + 1) = Range("U" & Target.Row)
        End If
    End If
    
    If Target.Column = 7 Or Target.Column = 9 Then
        If UCase(Range("G" & Target.Row)) = UCase("Transfer Chequing-Celi") _
           And Range("I" & Target.Row) <> "" Then
                Range("AC" & celLR + 1) = Range("C" & Target.Row)
                Range("AE" & celLR + 1) = Range("G" & Target.Row)
                Range("AI" & celLR + 1) = Range("I" & Target.Row)
        End If
    End If
    
    If Target.Column = 31 Or Target.Column = 33 Then
        If UCase(Range("AE" & Target.Row)) = UCase("Transfer Celi-Chequing") _
           And Range("AG" & Target.Row) <> "" Then
                Range("C" & chqLR + 1) = Range("AC" & Target.Row)
                Range("G" & chqLR + 1) = Range("AE" & Target.Row)
                Range("K" & chqLR + 1) = Range("AG" & Target.Row)
        End If
    End If
    
    If Target.Column = 7 Or Target.Column = 9 Then
        If UCase(Range("G" & Target.Row)) = UCase("Transfer Chequing-Line") _
           And Range("I" & Target.Row) <> "" Then
                Range("AO" & celLR + 1) = Range("C" & Target.Row)
                Range("AQ" & celLR + 1) = Range("G" & Target.Row)
                Range("AU" & celLR + 1) = Range("i" & Target.Row)
        End If
    End If
    
    If Target.Column = 43 Or Target.Column = 45 Then
        If UCase(Range("AQ" & Target.Row)) = UCase("Transfer Line-Chequing") _
           And Range("AS" & Target.Row) <> "" Then
                Range("C" & marLR + 1) = Range("AO" & Target.Row)
                Range("G" & marLR + 1) = Range("AQ" & Target.Row)
                Range("K" & marLR + 1) = Range("AS" & Target.Row)
        End If
    End If
    
    Application.EnableEvents = True
    End Sub
    I don't understand why I can transfer values from :

    Chequing to Savings account and vice versa,
    Chequing to Celi
    and Chequing to Line

    but I can't transfer from Celi to chequing and
    LIne to Chequing.

    My second question is :
    Why do the values in Line of credit appear in AO9 instead of AO7 ?

    Thanks for your answer. This project is important for me

    Camaalot
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 8
    Last Post: 12-02-2017, 11:59 AM
  2. [SOLVED] Transfer from one table to another auto sorting table
    By Noobulon in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-26-2017, 02:35 PM
  3. [SOLVED] Transfer a sub Table (column in a table) into VBA array
    By omarehabsalama in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-16-2015, 09:43 PM
  4. Replies: 0
    Last Post: 05-17-2014, 07:25 PM
  5. [SOLVED] Transfer current row of data (Table) to a new row in a second table on the same sheet
    By jrtraylor in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-12-2013, 11:12 PM
  6. Replies: 4
    Last Post: 01-18-2013, 10:49 PM
  7. UserForm to transfer items from one table to another table in the next empty cell...
    By aneese11 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-04-2012, 10:31 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1