COUNT and Copy to Last Row, Paste to another sheet to Last Row (FIRST EMPTY ROW, adding, not replacing value)

Semiro

New Member
Joined
Feb 4, 2021
Messages
3
Office Version
  1. 2019
Platform
  1. Windows
Hey friends. Im New in VBA. Could you help me at this?

So, we have 2 columns: AB with data, in Sheet1
I want to COPY until Last Row in AB Column from Sheet1
and paste it to Sheet2, column CD in FIRST EMPTY ROW (i mean while adding more data, cause CD is supposed to have previous data)

Can anyone help? It would be a huge favour for me! THANKS !!
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Hello Semiro,

Here's one way:-

VBA Code:
Sub Test()

Sheet1.Range("AB2", Sheet1.Range("AB" & Sheet1.Rows.Count).End(xlUp)).Copy Sheet2.Range("CD" & Rows.Count).End(3)(2)

End Sub

I'm assuming that there is a heading in both columns.

I hope that this helps.

Cheerio,
vcoolio.
 
Upvote 0
Solution
Hello Semiro,

Here's one way:-

VBA Code:
Sub Test()

Sheet1.Range("AB2", Sheet1.Range("AB" & Sheet1.Rows.Count).End(xlUp)).Copy Sheet2.Range("CD" & Rows.Count).End(3)(2)

End Sub

I'm assuming that there is a heading in both columns.

I hope that this helps.

Cheerio,
vcoolio.
Thank you my friend
 
Upvote 0
Hello Semiro,

Here's one way:-

VBA Code:
Sub Test()

Sheet1.Range("AB2", Sheet1.Range("AB" & Sheet1.Rows.Count).End(xlUp)).Copy Sheet2.Range("CD" & Rows.Count).End(3)(2)

End Sub

I'm assuming that there is a heading in both columns.

I hope that this helps.

Cheerio,
vcoolio.
Hey my friend,

Is this possible:

In Sheet1 i have data. If in Column L, cells contain "Yes",
then Copy ONLY cells from Column B and Column D of the SAME ROW
and Paste to Sheet2 in Column A and Column C?

Please.
 
Upvote 0
Hello Semiro,

Yes, that can be done. Here is one method of doing it:-
VBA Code:
Option Explicit
Sub Test()
                
        Dim x As Long
        Dim nrow As Long: nrow = Sheet2.Cells(Rows.Count, 1).End(xlUp).Row + 1
        Dim clArr As Variant: clArr = Array(2, 4)
        Dim pArr As Variant: pArr = Array("A", "C")
        
Application.ScreenUpdating = False

    With Sheet1.[A1].CurrentRegion
            .AutoFilter 12, "Yes"
                    With .Offset(1)
                            For x = LBound(clArr) To UBound(clArr)
                                 .Columns(clArr(x)).Copy Sheet2.Range(pArr(x) & nrow)
                            Next x
                    End With
            .AutoFilter
    End With
        
Application.ScreenUpdating = True

End Sub

Again, I'm assuming that there are headings in Row1 of both sheets.

I hope that this helps.

Cheerio,
vcoolio.
 
Upvote 0

Forum statistics

Threads
1,214,875
Messages
6,122,040
Members
449,063
Latest member
ak94

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