VBA Macro copy cells or range in different workbooks same worksheet name to a single master workbook with date in every row

rozek

New Member
Joined
Aug 11, 2021
Messages
29
Office Version
  1. 365
Platform
  1. Windows
Hi. I'm new to this Forum. Any help is much appreciated. The objective as per the snapshot where I need to copy & paste only for colored cells. I guess the only difference from the other posts is how to add the dates repeatedly in the Mastersheet. Need some sort of looping I guess. Appreciate any help. Thank you
excel vba.png
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
@rozek how are those cells colored in each of those workbooks? Are they colored via conditional formatting? or some other way?
 
Upvote 0
@rozek how are those cells colored in each of those workbooks? Are they colored via conditional formatting? or some other way?
Thank you johnnyL for reply. Just ignore the color. the color is just to show example the position of the value in the cell from copy to paste.
 
Upvote 0
Ok, colors will be ignored.

Are all of the workbooks setup exactly as you described them via picture?

Do All of them have a separate date line followed by 3 lines of additional data?

Which columns and rows are the data in?

Are all of the workbooks opened when the code is ran? Is it only 3 workbooks in addition to the current workbook that contains the 'Mastersheet'?

Please be specific for what you have and what you want.
 
Upvote 0
I should have made it clear. My apologies. Please see the XL2BB below. Ignore the colors (just to show where the cells position). Thank you for your help :)

wrkbook1.xls
ABCD
1DATE:4-Aug-21
2 NAMEHOURSPRESSTEMP
3A0129088
4B0119096
5C8960162
Sheet1


wrkbook2.xls
ABCD
1DATE:5-Aug-21
2 NAMEHOURSPRESSTEMP
3A0125055
4B5100066
5C2496077
Sheet1


wrkbook3.xls
ABCD
1DATE:6-Aug-21
2 NAMEHOURSPRESSTEMP
3A0100065
4B890087
5C4500140
Sheet1



The final product

wrkbook.xlsm
ABCD
1DATE NAMEPRESSTEMP
24-Aug-21A129088
34-Aug-21B119096
44-Aug-21C960162
55-Aug-21A125055
65-Aug-21B100066
75-Aug-21C96077
86-Aug-21A100065
96-Aug-21B90087
106-Aug-21C500140
Mastersheet
 
Upvote 0
Ok the columns/rows question was answered, how about the rest of the questions?
 
Upvote 0
Ok the columns/rows question was answered, how about the rest of the questions?
Are all of the workbooks setup exactly as you described them via picture?
Yes, the setup is exactly like in XL2BB with 3 workbooks having same sheet name 'sheet1' and 1 master wrkbook.xlsm with sheet name Mastersheet.

Do All of them have a separate date line followed by 3 lines of additional data?
Yes, all source workbooks have separate date in cell B:1. When pasted, the date should be available in column A accordingly following the number of rows for that particular sheet.

Which columns and rows are the data in?
As per XL2BB snapshot

Are all of the workbooks opened when the code is ran?
Only the master workbook opens. Don't show the source workbooks.

Is it only 3 workbooks in addition to the current workbook that contains the 'Mastersheet'?
For this example yes it is only for these 3 source workbooks. May add other workbooks in the future.

Thank you again for your time and help Sir. Appreciate it alot.
 
Upvote 0
Can the closed workbooks be opened to process the data from them?
 
Upvote 0
Can the closed workbooks be opened to process the data from them?
Hi Johnny. Yes, the closed wrkbook can be open, process the data and closed afterwards when data pasted in the master workbook.
 
Upvote 0
Another question, Are the closed workbooks all in the same folder or will each closed folder path need to be asked from the user?

In other words, do you know the path to the closed files or do you have to ask the user for each closed file?

In more other words, what is the path that the closed files are in, if you know it.
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,906
Members
452,366
Latest member
TePunaBloke

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