How to copy a number of rows based on a drop down choice

shauns

New Member
Joined
Feb 19, 2019
Messages
4
Hi All,

I want to copy a number of rows from an 'Archive' spreadsheet to a 'Previous_Sites_Visits' spreadsheet based on a drop down selection in the 'Input' spreadsheet.

I have a site visit workbook where site data can be entered in a form on the 'Input' spreadsheet. Once the relevant data has been filled in, a submit button is pressed which copies the data to a 'Data' spreadsheet and clears the 'Input' form ready for the next site details to be entered. Once a number of sites have been visited and the data is ready to be put into our database a "Generate .zrxp" button is pressed on the 'Data' spreadsheet which creates a data file compatible with our database, copies the data to the 'Archive' spreadsheet, and clears the entries in the 'Data' spreadsheet.

I would like to be able to interrogate the 'Archive' spreadsheet so that when a site is selected in the drop down menu in 'Input!B2' all rows containing that site name in the 'Archive' spreadsheet are automatically copied into the 'Previous_Site_Visits' spreadsheet in date order, with the last visit at the top.

I am not very good with VBA so I have tried to record a macro to help me, but I think it is not working because the reference cell is a drop down box and I can't seem to fix the value when copying and pasting rows. I have also tried Vlookups but the Archive table is not organised by the unique reference (site name) but by the date of the visit. It also looks like Vlookups can only return one value from an array rather than a number of columns. I tried looking at a solution with 3 helper columns that assigned row numbers etc, but I couldn't make it work because the 'Archive' sheet is dynamic and rows will continuously be added to it.

Any help would be much appreciated.

Cheers.
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
You could upload a copy of your file to a free site such as www.box.com or www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. If the workbook contains confidential information, you could replace it with generic data.

In the sheets of the file simulates with colors which rows should be copied.
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,252
Members
452,623
Latest member
Techenthusiast

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