Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Consolidating data from various worksheet of same excel file

Hi All,

I have got a data which is regularly updated by my colleagues in Excel file
which is a shared file saved in a share drive.

There are around 35 to 40 worksheet. One worksheet for each employees. It
has 9 columns. I want a macro which will import data entered in all these 35
to 40 worksheet into one master worksheet of the same or another file. Where
in I can prepare some pivot tables to do some analysis.

Is it possible to get all the data from these many worksheet into one master
worksheet by click of a button.

Cheers,
Mandeep
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 367
Default Consolidating data from various worksheet of same excel file

Hello Mandeep

sure it is possible.

You can go through every worksheet with a for loop:

dim ws as worksheet

for each ws in worksheets
'here comes the code to copy your data
next ws

if you want to exclude your Mainsheet you have to do it like that

for each ws in worksheets
if ws.name < "mainsheet" then
'here comes the code to copy your data
end if
next ws

hope that is clear...i don't know how your layout looks like, and i
don't know how you want to arrange it on the mainsheet so that's how
far i can help you. If you want more information, please ask.

Hth

Carlo



On Dec 21, 2:41*pm, Mandeep Dhami
wrote:
Hi All,

I have got a data which is regularly updated by my colleagues in Excel file
which is a shared file saved in a share drive.

There are around 35 to 40 worksheet. One worksheet for each employees. It
has 9 columns. I want a macro which will import data entered in all these 35
to 40 worksheet into one master worksheet of the same or another file. Where
in I can prepare some pivot tables to do some analysis.

Is it possible to get all the data from these many worksheet into one master
worksheet by click of a button.

Cheers,
Mandeep


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Consolidating data from various worksheet of same excel file

Thanks Carlo for your help.

I am unable to understand the solution given by you. I am sending you an
attachment of the file that I am referrring to. Hope this will give you an
idea of what exactly I require.

Cheers,
Mandeep

"carlo" wrote:

Hello Mandeep

sure it is possible.

You can go through every worksheet with a for loop:

dim ws as worksheet

for each ws in worksheets
'here comes the code to copy your data
next ws

if you want to exclude your Mainsheet you have to do it like that

for each ws in worksheets
if ws.name < "mainsheet" then
'here comes the code to copy your data
end if
next ws

hope that is clear...i don't know how your layout looks like, and i
don't know how you want to arrange it on the mainsheet so that's how
far i can help you. If you want more information, please ask.

Hth

Carlo



On Dec 21, 2:41 pm, Mandeep Dhami
wrote:
Hi All,

I have got a data which is regularly updated by my colleagues in Excel file
which is a shared file saved in a share drive.

There are around 35 to 40 worksheet. One worksheet for each employees. It
has 9 columns. I want a macro which will import data entered in all these 35
to 40 worksheet into one master worksheet of the same or another file. Where
in I can prepare some pivot tables to do some analysis.

Is it possible to get all the data from these many worksheet into one master
worksheet by click of a button.

Cheers,
Mandeep



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 367
Default Consolidating data from various worksheet of same excel file

Hi Mandeep, this is the solution:

Sub Consolidate()

Dim ws As Worksheet
Dim ws_main As Worksheet

Set ws_main = Worksheets("Master worksheet")

For Each ws In Worksheets
If ws.Name < ws_main.Name Then
'actual copying
ws.Range("a2:i" & ws.Cells(65536, 1).End(xlUp).Row).Copy
ws_main.Range("a" & ws_main.Cells(65536, 1).End(xlUp).Row + 1)
End If
Next ws

End Sub


hth

Carlo


On Dec 21, 3:53*pm, Mandeep Dhami
wrote:
Thanks Carlo for your help.

I am unable to understand the solution given by you. I am sending you an
attachment of the file that I am referrring to. Hope this will give you an
idea of what exactly I require.

Cheers,
Mandeep



"carlo" wrote:
Hello Mandeep


sure it is possible.


You can go through every worksheet with a for loop:


dim ws as worksheet


for each ws in worksheets
* *'here comes the code to copy your data
next ws


if you want to exclude your Mainsheet you have to do it like that


for each ws in worksheets
* *if ws.name < "mainsheet" then
* * * 'here comes the code to copy your data
* *end if
next ws


hope that is clear...i don't know how your layout looks like, and i
don't know how you want to arrange it on the mainsheet so that's how
far i can help you. If you want more information, please ask.


Hth


Carlo


On Dec 21, 2:41 pm, Mandeep Dhami
wrote:
Hi All,


I have got a data which is regularly updated by my colleagues in Excel file
which is a shared file saved in a share drive.


There are around 35 to 40 worksheet. One worksheet for each employees. It
has 9 columns. I want a macro which will import data entered in all these 35
to 40 worksheet into one master worksheet of the same or another file. Where
in I can prepare some pivot tables to do some analysis.


Is it possible to get all the data from these many worksheet into one master
worksheet by click of a button.


Cheers,
Mandeep- Hide quoted text -


- Show quoted text -


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macros for Consolidating data in worksheet 1 on worksheet 2 Omokehinde Excel Programming 1 March 4th 12 01:45 PM
consolidating data in an excel worksheet potman Excel Discussion (Misc queries) 1 July 29th 08 11:56 AM
Consolidating Sales Data to Summary Worksheet Lessable Excel Worksheet Functions 0 May 30th 08 06:24 PM
Consolidating Data to one worksheet JEFF Excel Programming 4 October 7th 06 10:30 PM
Need advice : consolidating data from multiple CSV files in Excel - External data handling Matthieu Gaillet Excel Programming 0 December 1st 05 09:02 AM


All times are GMT +1. The time now is 02:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"