Conditionally copy and paste of the data between multiple sheets in a workbook

If in column K  BUY is mentioned then paste that data to sheet2
If in column K  SELL is mentioned then paste that data to sheet3
plz see the sample file
Book9.xlsb
Sachin SinghAsked:
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.

Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
Please give this a try...

Sub CopyData()
Dim sws As Worksheet, dws1 As Worksheet, dws2 As Worksheet
Application.ScreenUpdating = False
Set sws = Sheets("Sheet1")
Set dws1 = Sheets("Sheet2")
Set dws2 = Sheets("Sheet3")
dws1.Cells.Clear
dws2.Cells.Clear
sws.AutoFilterMode = False
With sws.Range("A1").CurrentRegion
    .AutoFilter field:=11, Criteria1:="BUY"
    .SpecialCells(xlCellTypeVisible).Copy dws1.Range("A1")
    .AutoFilter field:=11, Criteria1:="SELL"
    .SpecialCells(xlCellTypeVisible).Copy dws2.Range("A1")
    .AutoFilter
End With
Application.ScreenUpdating = True
End Sub

Open in new window

Click the button called "Copy Data" on Sheet1 to run the code.
Book9.xlsb
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
Sachin SinghAuthor Commented:
Thnx Neeraj Sir for ur great support
0
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
You're welcome Sachin!
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 Office

From novice to tech pro — start learning today.