1

I have 141 excel sheets. I need two columns from each sheet evantually dumped into one giant csv file. This is what I have so far:

Sub ColumnCopytoCSV()
'
' ColumnCopytoCSV Macro
'
' Keyboard Shortcut: Ctrl+Shift+Q
'

    Range("C:C,H:H").Select
    Range("H1").Activate

    Selection.Copy
    Application.CutCopyMode = False
    Selection.Copy
    Workbooks.Add
    Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
        xlNone, SkipBlanks:=False, Transpose:=False
    Application.CutCopyMode = False

    strFileFullName = ThisWorkbook.FullName


    ActiveWorkbook.SaveAs Filename:=strFileFullName & ".csv", FileFormat:=xlCSV, _
        CreateBackup:=False
    ActiveWindow.Close
End Sub

A few problems...

1) Excel requires my personal workbook to be open, but "ThisWorkBook" keeps pulling "Personal" instead FileX, and FileY's names. I would like the exported files to be named FileX.csv and FileY.csv, based on where they were pulled from.

2) Once the naming is correct, would I simply use the Append commands to patch all of the files together?

paperfairy
  • 57
  • 6
  • 1
    I'd recommend combining all the files first, then removing the items you don't need. Check this answer out: http://stackoverflow.com/questions/25596171/merge-multiple-csv-files-using-batch-file – Ryan Wildry Aug 19 '16 at 20:24

0 Answers0