Solved

tranform row to column...across 500 excel workbooks

Posted on 2015-02-17
21
88 Views
Last Modified: 2016-02-11
i have a folder of 500 workbooks

i have data in a1
then across row 2 --- of varying length

i need to append all this data into one column

i would like to do it across every workbook automaticaly
0
Comment
Question by:finnstone
  • 12
  • 9
21 Comments
 
LVL 45

Expert Comment

by:aikimark
ID: 40613990
Please post a workbook with representative data.
Where do you need to place this transformed data?
0
 

Author Comment

by:finnstone
ID: 40614020
0
 
LVL 45

Expert Comment

by:aikimark
ID: 40614055
Your workbook needs to show what the transformed data should look like.  Please post your files in this thread.
animatedtabs.csv
0
 

Author Comment

by:finnstone
ID: 40614074
I need All the data in column A that's it
0
 
LVL 45

Expert Comment

by:aikimark
ID: 40614231
0
 

Author Comment

by:finnstone
ID: 40614246
yes
0
 
LVL 45

Accepted Solution

by:
aikimark earned 500 total points
ID: 40614581
Here is a VBA routine to do this for all the csv files in a directory.  Change the cPath string literal to point to the directory with your 500 csv files.
Sub Q_28618360()
    Dim strFilename As String
    Dim wkb As Workbook
    Dim wks As Worksheet
    Const cPath As String = "C:\Users\AikiMark\Downloads\Q_28618360\"
    strFilename = Dir(cPath & "*.csv")
    Do Until Len(strFilename) = 0
        Set wkb = Workbooks.Open(cPath & strFilename)
        Set wks = wkb.Sheets(1)
        wks.Range(wks.Range("A2"), wks.Range("A2").Offset(ActiveSheet.Range("A2").End(xlToRight).Column - 1, 0)).Value = _
            WorksheetFunction.Transpose(wks.Range(wks.Range("A2"), wks.Range("A2").End(xlToRight)).Value)
        wks.Range(wks.Range("B2"), wks.Range("B2").End(xlToRight)).ClearContents
        wkb.Close True
        strFilename = Dir
    Loop

End Sub

Open in new window

0
 

Author Comment

by:finnstone
ID: 40614740
strFilename  is equaling "" everytime ...
0
 
LVL 45

Expert Comment

by:aikimark
ID: 40614811
What does your code look like?
Where are your CSV files?
0
 

Author Comment

by:finnstone
ID: 40614830
i used your code exactly
put it in a module
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:finnstone
ID: 40614832
yes i modified path to correct path
0
 
LVL 45

Expert Comment

by:aikimark
ID: 40614881
Are you invoking the routine in the module?
0
 

Author Comment

by:finnstone
ID: 40614883
no. how do i do that?
0
 
LVL 45

Expert Comment

by:aikimark
ID: 40614938
just invoke it by name somewhere in the file, usually at the top of the file.

Also, make sure your path ends with a back slash, like mine did.
0
 

Author Comment

by:finnstone
ID: 40614960
beautiful got it :)
0
 

Author Comment

by:finnstone
ID: 40614961
thanks this is awesome!
0
 

Author Closing Comment

by:finnstone
ID: 40614965
great!!
0
 
LVL 45

Expert Comment

by:aikimark
ID: 40615034
Is this a one-time transform?
0
 

Author Comment

by:finnstone
ID: 40615041
yeah already done. posting a new problem though :)
0
 
LVL 45

Expert Comment

by:aikimark
ID: 40615062
post a link to that new question in this thread
0
 

Author Comment

by:finnstone
ID: 40615070
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Here I am using Python IDLE(GUI) to write a simple program and save it, so that we can just execute it in future. Because when we write any program and exit from Python then program that we have written will be lost. So for not losing our program we…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now