Solved

tranform row to column...across 500 excel workbooks

Posted on 2015-02-17
21
91 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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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.

 

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

829 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