Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Adding all the data to one sheet

Hi all,
I have several sheets in one file. All the sheets are containing the
same columns but different data. I need to copy all the data of each
sheet to one master sheet for analysis. How to do it? I mean master
sheet can have data from 1st sheet then without leaving any blank
rows, data from the 2nd sheet to be copied then without leaving any
blank rows data from 3rd sheet to be copied and so on for around 34
sheets. I think I am clear what I need.

Thanks for any help.
Raja
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Adding all the data to one sheet

I have a example on this page Mac
http://www.rondebruin.nl/tips.htm


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Mac" wrote in message ...
Hi all,
I have several sheets in one file. All the sheets are containing the
same columns but different data. I need to copy all the data of each
sheet to one master sheet for analysis. How to do it? I mean master
sheet can have data from 1st sheet then without leaving any blank
rows, data from the 2nd sheet to be copied then without leaving any
blank rows data from 3rd sheet to be copied and so on for around 34
sheets. I think I am clear what I need.

Thanks for any help.
Raja



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Adding all the data to one sheet

Hi Mac
Try using this code. You may have to modify the cell references to sui
your data.

Sub CopySheets()
Dim MySheet As Integer
For MySheet = 2 To 34
Sheets(MySheet).Activate
Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Sheets("Sheet1").Select
Range("A2").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
Next MySheet
End Su

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default Adding all the data to one sheet

Good attempt. You don't need to activate or select sheets
or ranges in order to use them. For example your code
becomes..

Sub CopySheets()
Dim MySheet As Long
For MySheet = 2 To 34
With Worksheets(MySheet)
.Range(.Range("A2"), _
.Range("A2").End(xlToRight).End(xlDown)).Copy
Worksheets(1).Range("A65000").End(xlUp).Offset
(1, 0).PasteSpecial xlAll
End With
Next MySheet
End Sub

Two issues here
One is that your columns are not defined. So if the
tables are of different widths, the your code will bring
everything in.

.Range(.Range("A2"), _
.Range("G2")xlToRight).End(xlDown)).Copy
This adjustment will only copy columns A to G

Furthermore, using a numeric index for the worksheets is
ok so long as one rembers that Excel numbers the sheets
according to the tab position...so "sheet1" isn't always
going to be worksheets(1)

patrick olloy
Microsoft Excel MVP




-----Original Message-----
Hi Mac
Try using this code. You may have to modify the cell

references to suit
your data.

Sub CopySheets()
Dim MySheet As Integer
For MySheet = 2 To 34
Sheets(MySheet).Activate
Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Sheets("Sheet1").Select
Range("A2").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
Next MySheet
End Sub


---
Message posted from http://www.ExcelForum.com/

.

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
adding new data to another sheet from the main sheet ycwkpp898 Excel Discussion (Misc queries) 1 January 6th 09 04:16 PM
Adding data from another sheet Dus@n Excel Worksheet Functions 2 March 15th 06 02:31 PM
adding new columns sheet with external data John New Users to Excel 0 September 23rd 05 08:00 PM
Adding buttons in a sheet to sort data Jimbob Excel Discussion (Misc queries) 1 July 1st 05 06:27 PM
adding data from one sheet to another sheet as a dropdown list bo. gatorguy Excel Discussion (Misc queries) 1 February 18th 05 10:51 PM


All times are GMT +1. The time now is 07:15 PM.

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"