Excel Macro - Copy Row to new WorkSheet

Hi Experts,


I need a macro that would do a copy and paste of rows into a new worksheet.  Let me explain better.

Worksheet "Table" contain over 25k rows and 16 columns

    I need to copy and paste
        all rows that contain the value "Yes" in column U
             into a the worksheet "Table2"
                   
This additional macro will be added to the Master workbook

Thanks for your help,
/mld
:)
mldaigle1Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rob HensonFinance AnalystCommented:
Apply a filter to the table and select the "Yes" value from the dropdown in column U.

You can then select all visible rows as a block and copy to the other sheet.

Thanks
Rob H
0
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
You may try like this........
Sub TransferDataToAnotherSheet()
Dim Sws As Worksheet, Dws As Worksheet
Dim Slr As Long
Dim Srng As Range
Application.ScreenUpdating = False
Set Sws = Sheets("Table")       'Source Sheet
Set Dws = Sheets("Table2")     'Destination Sheet
Slr = Sws.Cells(Rows.Count, "U").End(xlUp).Row
Set Srng = Sws.Range("U1:U" & Slr)
Dws.Cells.Clear
Sws.AutoFilterMode = 0
With Srng
    .AutoFilter field:=1, Criteria1:="Yes"
    .SpecialCells(xlCellTypeVisible).EntireRow.Copy Dws.Range("A1")
    .AutoFilter
End With
Application.ScreenUpdating = True
MsgBox "Done.", vbInformation
End Sub

Open in new window


Let me know if this helps.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mldaigle1Author Commented:
@ sktneer, this work exactly like I wanted, thanks

@ Rob, thanks for your help, filters are good solutions when i will do manuel copy.
0
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
You're welcome. Happy to help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.