View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Hemant_india[_2_] Hemant_india[_2_] is offline
external usenet poster
 
Posts: 107
Default Consolidating Data to one worksheet

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


"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!