HELP! - VBA to VLookup, Copy & Paste

Joey86

New Member
Joined
Jul 25, 2013
Messages
32
Hi Guys,

I really need help trying to get a VBA macro to do a Vlookup on another sheet then to find all the rows with that value, then copy them and paste them on another sheet, hopefully this is possible and that someone can help cause I don't have any knowledge on VBA.

Ok so I have 2 sheets, 'Daily Report' and 'Exceptions'. On the 'Daily Report' sheet when a user changes the sections in yellow shown below, I'm needing the macro to go to the 'Exceptions' page and lookup that selection criteria then copy all the values (might be more than 1 row) then it needs to come back to the 'Daily Report' sheet and paste the values down below in the green.

Daily Report Sheet
15099_10151832229131132_2000310083_n.jpg


Exceptions Sheet
1236763_10151832229141132_468470223_n.jpg
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Hi Andrew, thanks for the quick response, I tried it with the Exceptions Sheet, although it gave me an error of: 'You can only copy filtered data to the active sheet', I've uploaded a template of it here if it helps: Test_Book.xlsx

Thanks
 
Upvote 0
Yes, followed the video exactly, although now it's giving me the error of 'The extract range has a missing or invalid field name' not quite sure what that is. See the Exceptions sheet is a list from SharePoint that's feeding into it as a table so when I select the advanced filter as per below it gives me the error:
- List Range: Table_owssvr_13[[#All],[Customer]:[SLA Exempt]]
- Criteria Range: 'Consolidated Daily Report'!$F$7
- Copy To: 'Consolidated Daily Report'!$B$31:$K$44
 
Upvote 0
Check if your column headers in the source range, criteria range and destination are the same (No spelling differences / i'm not sure about case sensitivity). Field names refers to column names I think.
 
Upvote 0
In the workbook you posted, insert 2 rows above row 19 on sheet Daily Report. In B19 enter Customer. In B20 enter =B7. Select A1 and use the following Advanced filter settings:

List range: Exceptions!$A$1:$M$5
Criteria range: $B$19:$B$20
Copy to: $B$21:$J$21

Result:


Excel 2010
BCDEFGHIJ
19Customer
20Customer 1
21CustomerDateServerErrorSequenceReferenceReasonCurrent StatusExempt
22Customer 109/09/2013ABC12398700-00-00TestingGoodYes
23Customer 110/09/2013ABC12398700-00-00TestingGoodYes
24Customer 111/09/2013ABC12398700-00-00TestingGoodYes
Daily Report
 
Upvote 0
Yep, exactly the same, would formatting the headers on the 'Consolidated Daily Report' sheet make any difference like centering them in the cell?
 
Upvote 0
Andrew I tried it in the test worksheet and it worked fine, but for some reason in the actual worksheet it won't work :( also when you change the customer in B7 it's not changing over, is that the part the macro is supposed to record like you said earlier?
 
Upvote 0
The filter will need to be updated when the Customer changes.

Please copy the headings of the Filter range and paste them into a reply. Then copy the headings in the extract range and paste them.
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,310
Members
452,634
Latest member
cpostell

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