Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Combining tables from several spreadsheets

Hi.

I use Excel 2000 and have several sheets that I need to combine. On
every sheet there is a table, starting in A1, that will look something
like this:

(sheet1)
Ugs Uos Uws
A1 - B1 - C1
A2 - B2 - C2

(sheet2)
Ugs Uos Uws
A3 - B3 - C4
A4 - B3 - C4

There are about 40 of these tables on different sheets and I would
like to combine these on one sheet like this:

Ugs Uos Uws
A1 - B1 - C1
A2 - B2 - C2
A3 - B3 - C4
A4 - B3 - C4

How can I do this using VBA? The tables is of course much larger then
what I have shown you.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Combining tables from several spreadsheets

Hi Stian

Try this
http://www.rondebruin.nl/copy2.htm

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


"Stian Berg" wrote in message om...
Hi.

I use Excel 2000 and have several sheets that I need to combine. On
every sheet there is a table, starting in A1, that will look something
like this:

(sheet1)
Ugs Uos Uws
A1 - B1 - C1
A2 - B2 - C2

(sheet2)
Ugs Uos Uws
A3 - B3 - C4
A4 - B3 - C4

There are about 40 of these tables on different sheets and I would
like to combine these on one sheet like this:

Ugs Uos Uws
A1 - B1 - C1
A2 - B2 - C2
A3 - B3 - C4
A4 - B3 - C4

How can I do this using VBA? The tables is of course much larger then
what I have shown you.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Combining tables from several spreadsheets

Dim sh as Worksheet
Dim rng as Range
for each sh in ActiveWorkook.Worksheets
if sh.name < "Summary" then
set rng = sh.Range("A1").CurrentRegion
' don't include the header row
set rng = rng.offset(1,0).Resize(rng.rows.count-1)
rng.copy Destination:=worksheets("Summary") _
.Cells(rows.count,1).End(xlup)(2)
end if
Next

--
Regards,
Tom Ogilvy

"Stian Berg" wrote in message
om...
Hi.

I use Excel 2000 and have several sheets that I need to combine. On
every sheet there is a table, starting in A1, that will look something
like this:

(sheet1)
Ugs Uos Uws
A1 - B1 - C1
A2 - B2 - C2

(sheet2)
Ugs Uos Uws
A3 - B3 - C4
A4 - B3 - C4

There are about 40 of these tables on different sheets and I would
like to combine these on one sheet like this:

Ugs Uos Uws
A1 - B1 - C1
A2 - B2 - C2
A3 - B3 - C4
A4 - B3 - C4

How can I do this using VBA? The tables is of course much larger then
what I have shown you.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Combining tables from several spreadsheets

"Tom Ogilvy" wrote in message ...
Dim sh as Worksheet
Dim rng as Range
for each sh in ActiveWorkook.Worksheets
if sh.name < "Summary" then
set rng = sh.Range("A1").CurrentRegion
' don't include the header row
set rng = rng.offset(1,0).Resize(rng.rows.count-1)
rng.copy Destination:=worksheets("Summary") _
.Cells(rows.count,1).End(xlup)(2)
end if
Next


What a helpful group this is. Thanks to everyone that answered me,
specially to Tom who’s solution I used.

Best Regards

--
S.B.
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Combining tables from several spreadsheets

Hi Stian,
Try this, but I'm assuming all tables have 3 columns, but you can modify the code if
not.
HTH Mark

Sub Consolidate_Tables()
' Define Variables
Dim wks As Worksheet, wksConTable As Worksheet
' Add new worksheet for consolidated table
Set wksConTable = ThisWorkbook.Worksheets.Add
' Process each sheet
For Each wks In ThisWorkbook.Worksheets
' If not consolidated sheet
If wks.Name < wksConTable.Name Then
wks.Activate
' Copy table below current consolidated data
wks.Range(Cells(1, 1), Cells(wks.Cells(Cells.Rows.Count, 1).End(xlUp), 3)).Copy wksConTable.Cells(wksConTable.Cells(Cells.Rows.Cou nt, 1).End(xlUp) + 1, 1)
End If
Next wks
' Clear up
Set wksConTable = Nothing
End Sub

"Stian Berg" wrote:

Hi.

I use Excel 2000 and have several sheets that I need to combine. On
every sheet there is a table, starting in A1, that will look something
like this:

(sheet1)
Ugs Uos Uws
A1 - B1 - C1
A2 - B2 - C2

(sheet2)
Ugs Uos Uws
A3 - B3 - C4
A4 - B3 - C4

There are about 40 of these tables on different sheets and I would
like to combine these on one sheet like this:

Ugs Uos Uws
A1 - B1 - C1
A2 - B2 - C2
A3 - B3 - C4
A4 - B3 - C4

How can I do this using VBA? The tables is of course much larger then
what I have shown you.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Combining tables from several spreadsheets

If you don't want to include the headers change:
wks.Range(Cells(1, 1), Cells(wks.Cells(Cells.Rows...
to
wks.Range(Cells(2, 1), Cells(wks.Cells(Cells.Rows...

"Mark Heyhoe" wrote:

Hi Stian,
Try this, but I'm assuming all tables have 3 columns, but you can modify the code if
not.
HTH Mark

Sub Consolidate_Tables()
' Define Variables
Dim wks As Worksheet, wksConTable As Worksheet
' Add new worksheet for consolidated table
Set wksConTable = ThisWorkbook.Worksheets.Add
' Process each sheet
For Each wks In ThisWorkbook.Worksheets
' If not consolidated sheet
If wks.Name < wksConTable.Name Then
wks.Activate
' Copy table below current consolidated data
wks.Range(Cells(1, 1), Cells(wks.Cells(Cells.Rows.Count, 1).End(xlUp), 3)).Copy wksConTable.Cells(wksConTable.Cells(Cells.Rows.Cou nt, 1).End(xlUp) + 1, 1)
End If
Next wks
' Clear up
Set wksConTable = Nothing
End Sub

"Stian Berg" wrote:

Hi.

I use Excel 2000 and have several sheets that I need to combine. On
every sheet there is a table, starting in A1, that will look something
like this:

(sheet1)
Ugs Uos Uws
A1 - B1 - C1
A2 - B2 - C2

(sheet2)
Ugs Uos Uws
A3 - B3 - C4
A4 - B3 - C4

There are about 40 of these tables on different sheets and I would
like to combine these on one sheet like this:

Ugs Uos Uws
A1 - B1 - C1
A2 - B2 - C2
A3 - B3 - C4
A4 - B3 - C4

How can I do this using VBA? The tables is of course much larger then
what I have shown you.

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
filters don't work after combining several spreadsheets into one Trina New Users to Excel 3 April 29th 10 06:00 PM
Combining spreadsheets grim72 Excel Worksheet Functions 4 December 16th 09 08:46 AM
Combining two spreadsheets. Gameware Excel Discussion (Misc queries) 5 March 20th 08 09:30 PM
Combining spreadsheets to a master sheet [email protected] Excel Discussion (Misc queries) 1 May 18th 07 11:28 PM
Combining information from 2 Spreadsheets into 1 japc90 Excel Discussion (Misc queries) 1 May 2nd 07 09:56 PM


All times are GMT +1. The time now is 02:54 PM.

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

About Us

"It's about Microsoft Excel"