Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a huge Excel sheet and I would like to get a small list of cell (around 200-300 cells from the same column, row) into a CSV string.

Is there an Excel command to do that?. Saving the file into a CSV is not much of a help as the file is quite huge.

share|improve this question
Would it be an option to just copy the selected area and paste it into another worksheet? This would be quite simple with VBa – Dave Oct 25 '13 at 7:48
up vote 1 down vote accepted

You can use a VBA-macro. Change the range, to whatever you want. I choose A1:B3. Also you should change the filepath to a path, which you like.

Sub CopyToCSV()
    ActiveWorkbook.SaveAs Filename:= _
    "C:\Temp\yourCSV.csv" _
    , FileFormat:=xlCSV, CreateBackup:=False, Local:=True
    Application.DisplayAlerts = False
    Application.DisplayAlerts = True

End Sub

How to add a button to the excel-sheet to execute the macro

  1. Add a button (Form control)

    1. If the Developer tab is not available, display it.
      1. Click the Microsoft Office Button Button image, and then click Excel Options.
      2. In the Popular category, under Top options for working with Excel, select the Show Developer tab in the Ribbon check box, and then click OK.
  2. On the Developer tab, in the Controls group, click Insert, and then under ActiveX Controls, click Command Button Button image.

    Controls group

  3. Click the worksheet location where you want the upper-left corner of the command button to appear.

  4. In the Controls group, click View Code.
    This starts the Visual Basic Editor. Make sure that Click is selected in the dropdown list on the right. The sub procedure called CommandButton1_Click, as shown in the following picture, runs two macros when the button is clicked.


Now just repace the code of the CommandButton1_Clickwith the code inside the sub which I've posted on top of this.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .