Copy cells from one workbook to another

n3wpv

New Member
Joined
Jun 24, 2015
Messages
18
I have a macro project I need some help with. I have a source workbook that has one worksheet. This worksheet has row 1 as a header row. There could be up to 84 additional rows but this will sometimes vary. The columns used are A:AC. Column A will have either “MAX” or “MIN” as text. Column B will be text while columns C:AC will be numeric values. The rows will be sorted so that all “MAX” rows are together followed by all of the “MIN” rows.

Excel 2012
ABCD
1SAMPLEPR
2MAXD15-00-01-10.01950.0201
3MAXD15-00-01-110.04150.0335
4MAXD15-00-01-120.05750.0441
5MAXD15-00-01-130.02260.0202
6MAXD15-00-01-20.0160.0138
7MAXD15-00-01-30.0420.0444
8MAXD15-00-01-50.01130.0118
9MAXD15-00-01-60.03180.02
10MAXD15-00-01-70.01390.0124
11MAXD15-00-01-80.01710.016
12MAXD15-00-01-90.01040.0227
13MIND15-00-01-1-0.0017-0.0028
14MIND15-00-01-11-0.0016-0.0029
15MIND15-00-01-120.0031-0.0013
16MIND15-00-01-13-0.0021-0.0027
17MIND15-00-01-2-0.0025-0.0029
18MIND15-00-01-30.0014-0.0015
19MIND15-00-01-5-0.0028-0.0036
20MIND15-00-01-60.0009-0.0023
21MIND15-00-01-7-0.0026-0.0027
22MIND15-00-01-80.0004-0.0026
23MIND15-00-01-9-0.0026-0.0034

<tbody>
</tbody>
5319104 Sample PROFILE DATA



I have a read-only target workbook with multiple sheets. Two of these sheets are titled “Max Data” and “Min Data”. The source and target files are not in the same directory.

After the user has the target file open I’m looking to do the following:
1. User selects the source file via an OpenDialog box​
2. All rows in the source file that have “MAX” in column A are copied and pasted into the “Max Data” sheet in the target file. The range to copy would be B:AC and the target range in the target file would be the same.​
3. All rows in the source file that have “MIN” in column A are copied and pasted into the “Min Data” sheet in the target file. The range to copy would be B:AC and the target range in the target file would be the same.​
4. Close the source file without saving.​
5. Close the target file using a Save As dialog box so the user selects the location and filename.

Any help would be greatly appreciated!
 
Last edited:

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Forum statistics

Threads
1,214,832
Messages
6,121,843
Members
449,051
Latest member
excelquestion515

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