I get sent a spreadsheet by my supplier every week with 1000's of products.
i am only interested in about 50 products.
Column A has 'reference' as a heading and below are the products numbers and in the next columns are weights and prices
I want to be able to filter out the 'reference' numbers i am interested in, every time I get sent a new spreadsheet and put this data either somewhere on existing sheet or on a new page or even a new spreadsheet so I dont have to wade thru the huge long list.
I have tried filtering but this would need to be set up again each time i receive a new spreadsheet.
I think I need to make a makro but am in the dark as to how to go about this.
Any ideas please!
Thanks
Last edited by peteknopp; 02-16-2010 at 12:45 PM. Reason: solved
Is it always the same items?i am only interested in about 50 products.
You might take a look at using Advanced Filter with criteria, using the option to copy the results to a new location. See this link of Advanced Filter with criteria
The advanced filter can be easily automated with VBA. For more specific help post a sample workbook that meets the following criteria
1. It EXACTLY duplicates the structure of your real workbook, AND
2. It contains representative but non-sensitive dummy data, AND
3. It manually shows the expected/desire results.
Palmetto
Do you know . . . ?
You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.
Thanks Palmetto.
Filter items in a list may do what I need, but where does it put the data?
Attached is the type of file I use.
From the list of reference numbers in column A i will need to select about 50 and then place the results elsewhere.
The following week I would receive a new list and would need to again just filter out my 50 items to be displayed elsewhere.
Thanks
Pete
Here's a macro that will do it. It requires you create a sheet called "MasterList" and put your list of reference numbers of importance to you in column A as a list.
Then create a blank sheet called ExtractedList, and your raw data will go on a sheet called Data... then run this macro anytime you want a newly extracted set of data.
Code:Option Explicit Sub ExtractData() 'JBeaucaire 2/16/2010 Dim LR As Long: LR = Range("A" & Rows.Count).End(xlUp).Row Application.ScreenUpdating = False Sheets("ExtractedList").Cells.Clear With Sheets("Data") .Range("F1") = "Key" .Range("F2:F" & LR).FormulaR1C1 = "=ISNUMBER(MATCH(RC1,MasterList!C1,0))" .Range("F:F").AutoFilter Field:=1, Criteria1:="TRUE" .Range("A1:E" & LR).Copy Sheets("ExtractedList").Range("A1") .AutoFilterMode = False .Range("F:F").ClearContents End With Application.ScreenUpdating = True Sheets("ExtractedData").Activate Beep End Sub
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
“None of us is as good as all of us” - Ray Kroc
“Actually, I *am* a rocket scientist.” - JB (little ones count!)
Thanks Jbeaucaire.
That looks spot on!
I should have said I am a goon when it comes to Excel - I just dont use it often enough to learn it.
Now the silly question....
When my updated spreadsheet is emailed to me, how do I apply the macro to it? or do I copy the data on the updated sheet and paste it onto the example you did for me so that my same selected item are displayed on the extraction sheet?
Thanks again for your time!
Pete
I would just drop the new data onto the DATA sheet in columns A:E (column F needs to remain clear for this macro). Run the macro and the ExtractedList is instantly updated for you.
======
If that takes care of your need, be sure to EDIT your original post, click Go Advanced and mark the PREFIX box [SOLVED].
(Also, use the blue "scales" icon in our posts to leave Reputation Feedback, it is appreciated. It is found across from the "time" in each of our posts.)
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
“None of us is as good as all of us” - Ray Kroc
“Actually, I *am* a rocket scientist.” - JB (little ones count!)
Following Palmetto's Adv. Filter I came up with this macro
Your References go into Sheet2Code:Sub advFilter() Dim Ws As Worksheet Dim HeaderRng As Range, OutputRng As Range, FilterRng As Range, CriteriaRng As Range Dim Width As Long Set Ws = Worksheets("Sheet1") Set HeaderRng = Ws.Range(Range("A1"), Cells(1, Cells.Columns.Count).End(xlToLeft)) Set FilterRng = HeaderRng.CurrentRegion Width = HeaderRng.Columns.Count Set OutputRng = HeaderRng.Offset(1, Width + 3) Set CriteriaRng = HeaderRng.Offset(1, Width + 1).Resize(1, 1) HeaderRng.Copy OutputRng 'Output Range the same HeaderRng.Resize(1, 1).Copy CriteriaRng 'Output Range the same Range("RefList").Copy CriteriaRng.Offset(1, 0) Set CriteriaRng = CriteriaRng.Resize(1 + Range("RefList").Rows.Count, 1) FilterRng.AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=CriteriaRng, _ CopyToRange:=OutputRng, Unique:=True End Sub
press Alt-F11 and run the macro
I've tried to upload but It keeps on failing ??!!!
Change this Range("RefList")
into Range("Sheet2!A2:A51")
Last edited by rwgrietveld; 02-16-2010 at 05:24 AM.
Looking for great solutions but hate waiting?
Seach this Forum through Google
www.Google.com (e.g. +multiple +IF site:excelforum.com/excel-general/ )
www.Google.com (e.g. +fill +combobox site:excelforum.com/excel-programming/ )
Ave,
Ricardo
You have been more help than I can ever thank you for!
I will do as instructed re Solved and feedback after my last dumb question.....
Drop new data etc and then RUN MACRO. Does this happen automatically as I cant find a command.
Cheers
Pete
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
“None of us is as good as all of us” - Ray Kroc
“Actually, I *am* a rocket scientist.” - JB (little ones count!)
Thanks also Ricardo - I shall look at your option if it uploads but dont want to distract myself from JBeaucaires answer which is working for me!!! As mentioned before - I'm easily confused in Excel!
Jbeaucaire - I am using a Mac and TOOLS - Macro is where I went but no Macros listed. Is there a name for your macro that i need to insert.
The example you uploaded seemed to work automatically.
Last edited by peteknopp; 02-16-2010 at 05:36 AM.
I have just copied and pasted an earlier data sheet onto the example you made and the Extracted list has not updated. I go tools - macro and it asks for macro name. I do alt f8 and nothing happens. Please help at my last hurdle!
Thanks
Pete
office for mac wont run vbm so maybe i am best off trying all this in windows?
i have tried this in windows but
Sub ExtractData()
'JBeaucaire 2/16/2010
Dim LR As Long: LR = Range("A" & Rows.Count).End(xlUp).Row
Application.ScreenUpdating = False
Sheets("ExtractedList").Cells.Clear
With Sheets("Data")
.Range("F1") = "Key"
.Range("F2:F" & LR).FormulaR1C1 = "=ISNUMBER(MATCH(RC1,MasterList!C1,0))"
.Range("F:F").AutoFilter Field:=1, Criteria1:="TRUE"
.Range("A1:E" & LR).Copy Sheets("ExtractedList").Range("A1")
.AutoFilterMode = False
.Range("F:F").ClearContents
End With
Application.ScreenUpdating = True
Sheets("ExtractedData").Activate
Beep
End Sub
run time error 9
script out of range
is it because highlighted line has EXTRACTEDDATA and elsewhere it reads EXTRACTEDLIST
I edited the macro to read extractedlist and the macro ran but with no data on the extractedlist sheet
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks