SOLVED

Please can any one help with a macro?

%3CLINGO-SUB%20id%3D%22lingo-sub-1500598%22%20slang%3D%22en-US%22%3EPlease%20can%20any%20one%20help%20with%20a%20macro%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1500598%22%20slang%3D%22en-US%22%3E%3CP%3EBasically%20I%20want%20to%20enter%20a%20team%20name%20in%20I1%20(Milan%20eg).%20I%20then%20need%20Col%20H%20to%20be%20searched%20for%20the%20last%2050%20times%20%22Milan%22%20appears.%20I%20then%20just%20want%20COLS%20D%20E%20F%20G%20to%20be%20auto%20copied%20for%20me%20to%20paste%20elsewhere.%20Many%20thanks%20if%20anyone%20could%20help%20me%20with%20this.%26nbsp%3B%20%26nbsp%3BKind%20regards%20Dave%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Capture.JPG%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F202469iE3AC7C01DD89ED25%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22Capture.JPG%22%20alt%3D%22Capture.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%E2%80%83%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1500598%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1500634%22%20slang%3D%22en-US%22%3ERe%3A%20Please%20can%20any%20one%20help%20with%20a%20macro%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1500634%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F388038%22%20target%3D%22_blank%22%3E%40harwood66%3C%2FA%3E%26nbsp%3BIs%20this%20something%20you%20need%20to%20do%20very%20often%3F%20If%20not%2C%20consider%20using%20SEARCH%20to%20identify%20all%20rows%20that%20contain%20the%20search%20item%20from%20I1.%20Filter%20column%20I%20manually%2C%20copy%20and%20paste%20values%20from%20B%3AG.%20Or%2C%20if%20you%20are%20in%20the%20most%20recent%20Excel%20version%20that%20supports%20the%20FILTER%20function%2C%20you%20can%20further%20automate%20the%20process.%20Attached%20just%20a%20simplified%20example%20of%20what%20is%20possible%20without%20macro's.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Contributor

Basically I want to enter a team name in I1 (Milan eg). I then need Col H to be searched for the last 50 times "Milan" appears. I then just want COLS D E F G to be auto copied for me to paste elsewhere. Many thanks if anyone could help me with this.   Kind regards Dave

Capture.JPG

8 Replies

@harwood66 Is this something you need to do very often? If not, consider using SEARCH to identify all rows that contain the search item from I1. Filter column I manually, copy and paste values from B:G. Or, if you are in the most recent Excel version that supports the FILTER function, you can further automate the process. Attached just a simplified example of what is possible without macro's.

 

Hi @Riny_van_Eekelen . Thanks for your time. I currently search col H, then copy and past the last 50 occurrences in columns DEFG. I do this upto 100 times a week and is a bit of a long task. Was just wondering if it could be automated/speeded up?  Kind regards Dave

@harwood66 That sounds more like a job for "Get & Transform Data" a.k.a. PowerQuery (PQ). If you could upload a representative file, I or someone else out here, could guide you into creating a tool. I imagine you would type a club name in one cell and then press "Refresh" and PQ will spit out the top 50 list in a couple of seconds. (Provided you are not on a Mac!)

Hi @Riny_van_Eekelen   your help with this is much appreciated. I have attached a version of the file as requested. Basically I want to type a team in Col I4 and then get it to  copy and paste the last 50 appearances that the team appears in COLS D and E . The four cols I want to copy are DEFG so the cell count is 200. When copied I would simply paste the 200 cells into the next process. Thanks again Dave

@harwood66 Have a look at the attached workbook. Change the team name in the yellow cell (a Named Range called "SelectedTeam") on the "Data tab".

 

On the Data ribbon, press "Refresh All".

image.png

and go to the Top50 tab where you can pick-up the top 50 table for the selected team.

 

Now, the trick is that as long as your Data is stored in a structured table (and in this case called "Table1"). the refresh should work over-and-over-again. By selecting "Queries & Connections" you will be able to access the fairly simple queries that make it all possible. Try and see is this is a workable solution for you.

@Riny_van_Eekelen    Wow that is absolutely incredible to me. Am I able to update the "Data" table as per usual? I normally update from the bottom and then flip latest to the top. Cannot thank you enough you are so kind.  Regards Dave

 

Best Response confirmed by harwood66 (Contributor)
Solution

@harwood66 Just give it a try. As long as you keep the structured table called "Table1". No need to pre-sort. The query does that for you. Come back if you encounter any problems.

@Riny_van_Eekelen   Absolutely brilliant, you have saved me several hours a week. I am going to have a look at this PQ online, and try and pick it up. Kind regards Dave