Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Add data from several excel sheets into one
Kindly help me on this..
I have 25 excel sheets saves in my C drive... I wish to copy column z from first excel sheet & paste it col A of the new sheet. Then I wish to copy column z from second excel sheet & paste it col B of the new sheet. Then Col z of third sheet in Col C of new sheet So on so forth till i fiinish my last 25th sheet. This is something we can do manually but if we can do it using macro it would be great. Thanks a lot for help in advance.. Boss |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Add data from several excel sheets into one
try this code. The code is copying Column A of each worksheet. You may need
to make minor changes. Also change the Folder to the appropriate folder. Sub test() Const ForReading = 1, ForWriting = 2, ForAppending = 3 Folder = "C:\temp\test" Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0 Folder = "C:\temp\test" Set fsread = CreateObject("Scripting.FileSystemObject") Colcount = 1 First = True Do If First = True Then Filename = Dir(Folder & "\*.xls") First = False Else Filename = Dir() End If If Filename < "" Then 'open files Workbooks.Open Filename:=Folder & "\" & Filename ActiveWorkbook.ActiveSheet.Columns("A:A").Copy _ Destination:=ThisWorkbook.ActiveSheet.Columns(Colc ount) Colcount = Colcount + 1 ActiveWorkbook.Close End If Loop While Filename < "" End Sub "Boss" wrote: Kindly help me on this.. I have 25 excel sheets saves in my C drive... I wish to copy column z from first excel sheet & paste it col A of the new sheet. Then I wish to copy column z from second excel sheet & paste it col B of the new sheet. Then Col z of third sheet in Col C of new sheet So on so forth till i fiinish my last 25th sheet. This is something we can do manually but if we can do it using macro it would be great. Thanks a lot for help in advance.. Boss |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Add data from several excel sheets into one
This was awesome..
Thanks, Thanks a lot for your help.. Boss "Joel" wrote: try this code. The code is copying Column A of each worksheet. You may need to make minor changes. Also change the Folder to the appropriate folder. Sub test() Const ForReading = 1, ForWriting = 2, ForAppending = 3 Folder = "C:\temp\test" Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0 Folder = "C:\temp\test" Set fsread = CreateObject("Scripting.FileSystemObject") Colcount = 1 First = True Do If First = True Then Filename = Dir(Folder & "\*.xls") First = False Else Filename = Dir() End If If Filename < "" Then 'open files Workbooks.Open Filename:=Folder & "\" & Filename ActiveWorkbook.ActiveSheet.Columns("A:A").Copy _ Destination:=ThisWorkbook.ActiveSheet.Columns(Colc ount) Colcount = Colcount + 1 ActiveWorkbook.Close End If Loop While Filename < "" End Sub "Boss" wrote: Kindly help me on this.. I have 25 excel sheets saves in my C drive... I wish to copy column z from first excel sheet & paste it col A of the new sheet. Then I wish to copy column z from second excel sheet & paste it col B of the new sheet. Then Col z of third sheet in Col C of new sheet So on so forth till i fiinish my last 25th sheet. This is something we can do manually but if we can do it using macro it would be great. Thanks a lot for help in advance.. Boss |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to update data from multiple sheets to one specific sheets | Excel Discussion (Misc queries) | |||
Merging data from 2 data excel sheets | Excel Discussion (Misc queries) | |||
Multiple Sheets (Need to create 500 individual sheets in one workbook, pulling DATA | Excel Worksheet Functions | |||
Excel data across sheets | Excel Discussion (Misc queries) | |||
In 3 active sheets in wkbk, determine& display the # of sheets that have data | Excel Discussion (Misc queries) |