Copy/Paste Columns from one table in a sheet to another table in another sheet

hamzaaah

New Member
Joined
Aug 10, 2021
Messages
1
Office Version
  1. 2019
Platform
  1. Windows
1628605891681.png


This is Table3 in the Sheet Receipt. The first two columns are needed to be copied and their values are to be pasted in...

1628606118858.png


Table9 in Sheet IndividualProfitLoss.

Now Table9 is cleared by a code in VBA which is the following :

VBA Code:
Private Sub CommandButton2_Click()  'ActiveX button's click event handler
    Dim lo As ListObject, TABLE_NAME, arr
    For Each TABLE_NAME In Array("IndividualProfitLoss|Table9") 'and so on
        On Error Resume Next
        arr = Split(TABLE_NAME, "|")
        Set lo = Me.Parent.Sheets(arr(0)).ListObjects(arr(1))
        If Err.Number <> 0 Then
            MsgBox TABLE_NAME & " was not found. Check the table name", vbCritical + vbOKOnly, "Sub CommandButton1_Click()"
            Exit Sub
        End If
        On Error GoTo 0
        If Not lo.DataBodyRange Is Nothing Then lo.DataBodyRange.Delete
    Next
    End Sub

I just need help with copying and pasting the value of the first two columns of Table3 into the first two columns of Table9.
Any help would be appreciated.
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Forum statistics

Threads
1,224,747
Messages
6,180,716
Members
452,995
Latest member
isldboy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top