Filter data and copy to new worksheet macro code

nikhil0311

Board Regular
Joined
May 3, 2013
Messages
197
Office Version
  1. 2013
Platform
  1. Windows
I have an excel sheet with below columns and data.


Excel 2007
ABCDEFGHIJKLMN
1Client Event Tracking
2
3DateAug-15Jul-15Jan-15Jul-14
4New EventPebble BeachUS OpenLeadershipUS Open
5Client NameCASIDBankerBanker EmailGroupExecutive TitleExecutive Actual TitleExecutive Name
6Abc Inc123Dan, HEnergyCEOAcceptedYes
7Xyz LLC231Sam, KNortheastCFONoPostpone
8PQR Ltd876Nik, KMidwestTreasurerYes
9BBQ Equity435Sank, MEnergyOtherMaybe
10Dominos Inc232Dee, GTechnologyCEOCheckChange
Output



Now from the above data, i want to see data for Client 'Abc Inc' ONLY. So, I will put filter on Column A5 and select the client from Column A5 and then paste the visible data to new worksheet. see below for the output.



Excel 2007
ABCDEFGHIJK
1Client Event Tracking
2
3DateAug-15
4321New EventPebble Beach
5Client NameCASIDBankerBanker EmailGroupExecutive TitleExecutive Actual TitleExecutive Name
6Abc Inc123Dan, HEnergyCEOAccepted
Sheet1



similarly if i want to see data for Group - Energy, then i will go to column E5, select energy and copy paste the visible data to new worksheet

basically i want to create 5 button so the user can select the criteria based on below

Button1 - Client - when click on this button, one should be able to see all the client list and then select any of the client/clients. similarly for Banker, Group, Event button mentioned below
Button2 - Banker
Button3 - Group
Button4 - Event
and then when one click on 5th button i.e. Generate one should get the output based on the above filters in the new worksheet.

Let me know if you have any doubts?
 
Last edited:

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Anybody have any idea? is anyone working on my post? please reply if you are not able to understand any part of the post, let me know
 
Upvote 0
Anybody have any idea? is anyone working on my post? please reply if you are not able to understand any part of the post, let me know
I think you need only 1 button, ie the one that copy the filtered area and paste it to the other sheet; indeed the other buttons are equivalent to the Autofilter feature that you get when buy Excel.
Then associate the button to this macro:
Code:
Sub copyfilt()
DestSh = "Sheet2"                           '<<< The Destination sheet
Sheets(DestSh).Cells.ClearContents          '!! This CLEAR ALL the Destination Sheet
Range(Range("A1"), Range("A5").End(xlDown)).Resize(, 15).Copy _
    Destination:=Sheets(DestSh).Range("A1")
End Sub
The line marked <<< should be modified according your situation; and read the comment on next line!
If you intend that the data should be copied to a newly created worksheet then we shall slightly modify the code.

Bye
 
Upvote 0
Thanks a Ton for your Post Anthony. I need 5 buttons as these 5 buttons. 4 buttons are derived from 4 different columns mentioned by me above. and 5th button is to generate the data. i dont wanna do manual filter. i need the button to filter the data as per the selection.
 
Upvote 0
need some help here, why are people just viewing it, not responding anything? am i asking too much?? or it is not anyone's cup of tea?
 
Upvote 0
I'm not sure if you are aware, but this is a holiday season in many parts of the world! You sound very demanding for somebody who is seeking free help from volunteers. :(
Please refer to #12, second paragraph
 
Upvote 0
Apologies Sir, but i am counting on this forum and this was the 1st time it took so long for people to reply my post that's why i was a bit concerned. I know you have excellent VBA skills, can you please look into this?
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,687
Members
449,117
Latest member
Aaagu

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