kelly mort
Well-known Member
- Joined
- Apr 10, 2017
- Messages
- 2,169
- Office Version
- 2016
- Platform
- Windows
Hi,
I want a code that will browse for a file using a dialogue box.
After that I want to open the file. I do not want macros in this file to run (only if that's possible).
I run some codes when the workbook opens and I want to avoid that when I am opening it through this approach - that's triggering the open event from another workbook or using a code to open it. I was thinking of setting some global variables for that but I can't get the right way atm.
If I am able to open the file or workbook without running the scripts as described above, there are Worksheets that I want to match their names in both workbooks.
If they match, then I want to match or compare the contents or headers to see if they match as well.
If they match, then I want to copy from the file that I just opened into the workbook that I ran the code from.
Now let me describe my sheet names:
My sheets have the naming convention like:
PLAN 1
PLAN 2
PLAN 3
CAT 1
CAT 2
OBJ
so if both workbooks have PLAN 1, then I want to check if the contents on B6:AM6 are the same on both sheets.
If they match then I want to copy the data from the just opened workbook ( B7:AM & last used row) and paste into the workbook that I ran the code from.
And I repeat the same logic for all the other sheets;
PLAN 2
PLAN 3
CAT 1
CAT 2
OBJ
Afterwards, I close the workbook that I copied from.
Thanks in advance
Kelly
I want a code that will browse for a file using a dialogue box.
After that I want to open the file. I do not want macros in this file to run (only if that's possible).
I run some codes when the workbook opens and I want to avoid that when I am opening it through this approach - that's triggering the open event from another workbook or using a code to open it. I was thinking of setting some global variables for that but I can't get the right way atm.
If I am able to open the file or workbook without running the scripts as described above, there are Worksheets that I want to match their names in both workbooks.
If they match, then I want to match or compare the contents or headers to see if they match as well.
If they match, then I want to copy from the file that I just opened into the workbook that I ran the code from.
Now let me describe my sheet names:
My sheets have the naming convention like:
PLAN 1
PLAN 2
PLAN 3
CAT 1
CAT 2
OBJ
so if both workbooks have PLAN 1, then I want to check if the contents on B6:AM6 are the same on both sheets.
If they match then I want to copy the data from the just opened workbook ( B7:AM & last used row) and paste into the workbook that I ran the code from.
And I repeat the same logic for all the other sheets;
PLAN 2
PLAN 3
CAT 1
CAT 2
OBJ
Afterwards, I close the workbook that I copied from.
Thanks in advance
Kelly