Solved

tranform row to column...across 500 excel workbooks

Posted on 2015-02-17
21
92 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
 

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to demonstrate how we can use conditional statements using Python.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

749 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