PC Review


Reply
Thread Tools Rate Thread

Consolidating Data to one worksheet

 
 
=?Utf-8?B?SkVGRg==?=
Guest
Posts: n/a
 
      3rd Oct 2006
Hello,

I have a workbook with 50+ worksheets that have data in the exact same place
and format. I would like to take the contents of each worksheet and
consolidate it into a single worksheet, working downwards. For example, the
data in all sheets is found in A1:C3. I would like this consolidated
worksheet to have the contents of sheet one be in the same A1:C3, but sheet
two's data would go directly underneath, into cells A4:C6, sheet three's data
into cells A7:C9.... and so on.

Note:
1. The number of original worksheets could grow from 50 to 100
2. The consolidated data could be a new workbook, a new worksheet, or on
the first worksheet

Thanks a lot in advance!
 
Reply With Quote
 
 
 
 
Nigel
Guest
Posts: n/a
 
      3rd Oct 2006
The following will copy the range A1:C3 from every sheet onto the currently
active sheet, but not itself, offsetting the data by the value in xstep.
xlocate define the first copy destination.

Sub ConsSheets()
Dim wS As Worksheet
Dim xstep As Integer, xLocate As Long
xstep = 3: xLocate = 4
For Each wS In ActiveWorkbook.Worksheets
If wS.Index <> ActiveSheet.Index Then
wS.Range("A1:C3").Copy Destination:=ActiveSheet.Cells(xLocate, 1)
xLocate = xLocate + xstep
End If
Next
End Sub


--
Cheers
Nigel



"JEFF" <(E-Mail Removed)> wrote in message
news:5B243E1D-8F4B-4745-AA43-(E-Mail Removed)...
> Hello,
>
> I have a workbook with 50+ worksheets that have data in the exact same
> place
> and format. I would like to take the contents of each worksheet and
> consolidate it into a single worksheet, working downwards. For example,
> the
> data in all sheets is found in A1:C3. I would like this consolidated
> worksheet to have the contents of sheet one be in the same A1:C3, but
> sheet
> two's data would go directly underneath, into cells A4:C6, sheet three's
> data
> into cells A7:C9.... and so on.
>
> Note:
> 1. The number of original worksheets could grow from 50 to 100
> 2. The consolidated data could be a new workbook, a new worksheet, or on
> the first worksheet
>
> Thanks a lot in advance!



 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      3rd Oct 2006
See
http://www.rondebruin.nl/copy2.htm

--
Regards Ron de Bruin
http://www.rondebruin.nl



"JEFF" <(E-Mail Removed)> wrote in message news:5B243E1D-8F4B-4745-AA43-(E-Mail Removed)...
> Hello,
>
> I have a workbook with 50+ worksheets that have data in the exact same place
> and format. I would like to take the contents of each worksheet and
> consolidate it into a single worksheet, working downwards. For example, the
> data in all sheets is found in A1:C3. I would like this consolidated
> worksheet to have the contents of sheet one be in the same A1:C3, but sheet
> two's data would go directly underneath, into cells A4:C6, sheet three's data
> into cells A7:C9.... and so on.
>
> Note:
> 1. The number of original worksheets could grow from 50 to 100
> 2. The consolidated data could be a new workbook, a new worksheet, or on
> the first worksheet
>
> Thanks a lot in advance!



 
Reply With Quote
 
=?Utf-8?B?SGVtYW50X2luZGlh?=
Guest
Posts: n/a
 
      3rd Oct 2006
hi jeff
try this
dim temparray()

dim totalworksheets as integer
totalworksheets=activeworkbook.worksheets.count
dim n as integer
n=1
for each wk in activeWorkbook
worksheets(n).activate
rowcnt=activesheet.usedrange.rows.count
colcnt=activesheet.usedrange.columns.count
redim preserve temparray(rowcn,colcnt)
with activesheet
for x= 1 to rowcnt
for y= 1 to colcnt
temparray(x,y)=.cells(x,y)
next y
next x
end with
worksheets(totalworksheets+1).activate
with activesheet
for x1 = 1 to ubound(temarray,1)
for y1=ubound(temparray,2)

.cells(x1,y1)=temparray(x1,y1)
next y1
next x1
end with
n=n+1
redim temparray()
next

--
hemu
(E-Mail Removed)

"JEFF" wrote:

> Hello,
>
> I have a workbook with 50+ worksheets that have data in the exact same place
> and format. I would like to take the contents of each worksheet and
> consolidate it into a single worksheet, working downwards. For example, the
> data in all sheets is found in A1:C3. I would like this consolidated
> worksheet to have the contents of sheet one be in the same A1:C3, but sheet
> two's data would go directly underneath, into cells A4:C6, sheet three's data
> into cells A7:C9.... and so on.
>
> Note:
> 1. The number of original worksheets could grow from 50 to 100
> 2. The consolidated data could be a new workbook, a new worksheet, or on
> the first worksheet
>
> Thanks a lot in advance!

 
Reply With Quote
 
=?Utf-8?B?SkVGRg==?=
Guest
Posts: n/a
 
      7th Oct 2006
WORKS! thanks

"Nigel" wrote:

> The following will copy the range A1:C3 from every sheet onto the currently
> active sheet, but not itself, offsetting the data by the value in xstep.
> xlocate define the first copy destination.
>
> Sub ConsSheets()
> Dim wS As Worksheet
> Dim xstep As Integer, xLocate As Long
> xstep = 3: xLocate = 4
> For Each wS In ActiveWorkbook.Worksheets
> If wS.Index <> ActiveSheet.Index Then
> wS.Range("A1:C3").Copy Destination:=ActiveSheet.Cells(xLocate, 1)
> xLocate = xLocate + xstep
> End If
> Next
> End Sub
>
>
> --
> Cheers
> Nigel
>
>
>
> "JEFF" <(E-Mail Removed)> wrote in message
> news:5B243E1D-8F4B-4745-AA43-(E-Mail Removed)...
> > Hello,
> >
> > I have a workbook with 50+ worksheets that have data in the exact same
> > place
> > and format. I would like to take the contents of each worksheet and
> > consolidate it into a single worksheet, working downwards. For example,
> > the
> > data in all sheets is found in A1:C3. I would like this consolidated
> > worksheet to have the contents of sheet one be in the same A1:C3, but
> > sheet
> > two's data would go directly underneath, into cells A4:C6, sheet three's
> > data
> > into cells A7:C9.... and so on.
> >
> > Note:
> > 1. The number of original worksheets could grow from 50 to 100
> > 2. The consolidated data could be a new workbook, a new worksheet, or on
> > the first worksheet
> >
> > Thanks a lot in advance!

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
consolidating data in an excel worksheet potman Microsoft Excel Misc 1 29th Jul 2008 11:56 AM
Consolidating Sales Data to Summary Worksheet Lessable Microsoft Excel Worksheet Functions 0 30th May 2008 06:24 PM
Consolidating data from various worksheet of same excel file Mandeep Dhami Microsoft Excel Programming 3 21st Dec 2007 07:13 AM
Worksheet for Consolidating various Party Account Rashid Khan Microsoft Excel Misc 4 29th Jul 2004 08:24 PM
Help with worksheet consolidating Malcolm Microsoft Excel Programming 1 8th Aug 2003 03:58 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:37 AM.