Macro to select a range based on multiple criterias

Secret Chimpanzee

Board Regular
Joined
Jun 21, 2012
Messages
141
Hi,

I have two worksbooks - one with data (wb1) for the previous day and the other, a template (wb2) that the data needs to be copied into.

The data are results based on different groups in the business and their locations, and is sent everyday (and needs to be copied into wb2 each day). Wb2 also has these groups and locations listed but the group names are abbreviated.

I need a macro to search wb1 to do the following:

1. Look for the first group called "Melbourne" (this heading is usually in column 1)
2. Look for yesterday's date (column changes daily as the data is updated, but is always the last column with data in it)
3. Select and copy the 8 cells beneath the column with yesterday's date (the 9th row is the beginning of the next group and row of dates, then 8 rows of data under it)

4. Then go to wb2 and select the corresponding group called "MEL" as well as the matching date (yesterday's)
5. Paste the data (from wb1) into the cells below

Hopefully there is enough information here...

Thanks in advance.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Forum statistics

Threads
1,203,078
Messages
6,053,402
Members
444,662
Latest member
AaronPMH

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