• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Looping through different workbooks

Shailender

Member
Hi There, I need a code on the looping, Let's say I have one Masterfile which was saved in the common folder, And I have 3 more workbooks which was saved in the same location. So everyday three different people uses these 3 workbooks and saves the data through datewise. So i need a code that i want to copy all the data into my Masterfile through datewise. Example day 1 i want to copy all the data with date in the Masterfile, day two i want to copy the data into Masterfile below the day one. Like wise i need to copy all the data end of day.

Any help would be appreciated.

I have not attached any sample workbook, because the code related to different workbooks.
 
@Shailender ...
You have four workbooks somewhere and
You would like to copy from three workbooks datewise data to Masterfile!
Do You have anymore information of those files?
Do You know files names?
How many sheets?
Are those sheets layout's similar / compare to Masterfile?
Or are those workbooks empty now?
Should copy start automatic or manual in the end of day?
... whatever?
 
Hello, Vletm, than you for the quick reply. The filenames for these workbooks are 123719,123720 and 123721. I need to copy only Sheeet1 information from all the workbooks into masterfile, and those layout's are similar to the masterfile. These 3 workbooks have some data starting from range A1 to D10, and range may vary from day to day and end of the day i am copying it manually everyday. So need a code to copy the data automatically by clicking the button.
 
... or would it be better that those three workbooks would update MaterFile then someone will close those files?
Would Date find somewhere in range A1:D10 or where?
 
Yes Vletm, dates will be there in Column A and the data which updated it will be there in Column B and C, so what i need is all the data from these files should copy and paste everyday into masterfile.
 
@Shailender - Okay
With Your given information, here You are...
1) Modify 'init'-sheets file-names as You need
( there can be more than three files)
2) Press [Copy]-button in 'Sheet1'
 

Attachments

  • Shailender.xlsb
    38.9 KB · Views: 4
@vletm, Code is working fine, thank you for your help.

It is copying today's data, will it copy tomorrow's data as soon as when we run the code again..? and will it should paste tomorrow's data under the previous date data..?
 
It should copy one row which has today's date in A-column
from every workbook's 'sheet1' to Master-file (...actually to next row).
If You run more than once, it will make copy again.
If You need to run more than one row from those other workbooks then need to change code ...
 
@vletm, please refer to init Sheet, i have pasted the data which is there in sheets Ash.xlsx, Bsh.xlsx. As soon as i run the code it is copying only few cells data. what if it do if next day comes..? it should paste underneath the last date's date
For clarification please refer to init sheet.

Thank you in advance!
 

Attachments

  • Shailender.xlsb
    38.9 KB · Views: 2
It would be good to save file sometimes ...
I add some lines to show how do this work now.
(also there will be 'from which file information')
Tomorrow ... next days ... there will come again new rows ... if press the button!
 

Attachments

  • Shailender.xlsb
    50.2 KB · Views: 1
@vletm, as per above code it is copy only some text not the entire information. I need the headers and all the information which was there on current date like wise i need everyday's data to be pasted underneath the last day's date as soon as i hit the run button. As i pasted the values in int sheet colored with yellow and red and some other colors with different dates. I am adding the the information again in the int sheet.

Thank you in advance!
 

Attachments

  • Shailender.xlsb
    19.4 KB · Views: 1
As I wrote in #9 Reply:
If You need to run more than one row from those other workbooks then need to change code ...
I'll do something for next version!
 

Attachments

  • Shailender.xlsb
    64.3 KB · Views: 5
@vletm, thank you for your work, Sorry for delay in responding, Can i get for next version as well. And i request you to explain in detail what the macro is doing.

Thank you in advance!
 
... You have Your next version above!
For me, it copies colors, borders too and You can see 'source' right side!
What is missing?
 
The headers is not populating, and the code is copying only current date's data. Is it possible to paste the data below the yesterday's date so that i can have a track of each day's record.
 
You wrote:
Like wise i need to copy all the data end of day.
Headers:
Are headers different every day?
...and header do not have 'date stamp'! => cannot copy 'datewise'!
Copy:
Now You can copy only ONCE today's data!
I can think, how to copy 'uncopied' dates = dates which haven't saved to Master!
 
@vletm, The headers are same everyday. And the data will be saved datewise in those 3 workbooks. What i want exactly is i need copy the current date data from those 3 workbooks and the same should be saved in the Masterfile.

Sorry for the confusion. So that i will have a track on my masterfile. Hope this is clear.
Thank you in advance!
 
Screen Shot 2017-04-03 at 18.40.39.png
If headers are those ... then what would be a challenge?Screen Shot 2017-04-03 at 18.41.36.png
... and right side, You can see 'source'-file - okay?
from 2nd row = Sha_Workbook1
from 5th row = Sha_Workbook2
from 8th row ... nothing from Sha_Workbook3 !
... now just if someone would miss to press [Copy] that day would miss...
but as I wrote ... I'll do something for that - okay?
From which day You would like to get those datas?

>> So what is missing so far (except those missed dates)?
 
This version copies all data from 01/04/2017 to today ONCE!
(after clear those dates away from 'init'-sheet below 'done').
 

Attachments

  • Shailender.xlsb
    91.6 KB · Views: 1
@vletm, Sorry for delay in responding. Thank you for your time the macro codes are working. Need one more change as i am attaching the sheet for your reference.

Please refer to the sheet2,this is the data I have exactly in the other sheets. What I want is as you see the data is showing for 2nd of April, on the next day when I run the macro this data should populate in the Masterfile below 1st of April this month.Likewise it should save the data everyday. Hope it is clear now. Thank you!
 

Attachments

  • Shailender (3).xlsb
    19.1 KB · Views: 1
Back
Top