{"id":14228,"date":"2017-09-02T13:35:55","date_gmt":"2017-09-02T13:35:55","guid":{"rendered":"http:\/\/learnexcelmacro.com\/wp\/?p=14228"},"modified":"2022-08-09T19:35:46","modified_gmt":"2022-08-09T19:35:46","slug":"save-excel-range-data-as-csv-file-through-excel-vba","status":"publish","type":"post","link":"https:\/\/vmlogger.com\/excel\/2017\/09\/save-excel-range-data-as-csv-file-through-excel-vba\/","title":{"rendered":"Top 4 VBA Methods to Export Excel data as CSV File"},"content":{"rendered":"

In this article, I am going to teach you 4 VBA Methods of – how to export data from Excel Range to a CSV file format using Excel VBA. <\/em><\/strong><\/p>\n

\n

\u00a0 Did you know?<\/i><\/h2>\n

CSV<\/strong> is an abbreviation of C<\/strong>omma S<\/strong>eparated V<\/strong>alue. As the name suggests, it is clear that this file stores the tabular data in a format where data is separated by comma.
\nInterestingly, CSV is also a plain text file type. Here each line represents a row and each value separated by comma, resides in columns.<\/p>\n<\/div>\n

Important Note:<\/strong> Since comma is used as delimiter in CSV file – so what if your data itself has comma (,) as a value?<\/strong> To overcome this issue, CSV file format, stores such values within double quotes (” “) and then separated by comma(,).
\nLet’s get started then…<\/strong><\/p>\n

Methods of Exporting Excel data to CSV Files using VBA<\/h1>\n

In this article, following are the methods which I am using to Export Excel data i CSV format.<\/p>\n

\n
\n

<\/i>\u00a0 1. Export ActiveWorkSheet as CSV file<\/a><\/h2>\n

<\/i>\u00a0 2. VBA to export Excel Range to CSV File [Method 1]<\/a><\/h2>\n

<\/i>\u00a0 3. VBA to export Excel Range to CSV File [Method 2]<\/a><\/h2>\n

<\/i>\u00a0 4. VBA to Export Excel Table as CSV File<\/a><\/h2>\n<\/div>\n<\/div>\n

Before we go in to details, I would like to recommend you guys to go through following tutorials<\/a> – this will help you in understanding the code better –
\nIn
following tutorial<\/a> about interaction with text files through Excel VBA, we have talked a lot about creating new text files, exporting data from an Excel Range to Text file and so many other different topics.
\n
VBA Guide to Interact with Text Files \u2013 Part \u2013 1<\/a>
\n
VBA Guide to Interact with Text Files \u2013 Part \u2013 2 <\/a><\/p>\n

<\/a><\/p>\n

1. Export ActiveWorkSheet as CSV file<\/h1>\n

Advantages of this method<\/h2>\n

1. This is a very simple and quickest method to export your Excel data to a CSV file.
\n2. No extra coding required in order to maintain the comma delimiter or double quotes etc. Excel does it by itself.<\/p>\n

At the same time, this method has some short comings or challenges as well.<\/p>\n

Drawbacks of this Method<\/h2>\n

1. In this method, data from ActiveSheet is saved as CSV file only. It ignores rest other sheets and its data.
\n2. You do not have control over data – which one to be exported or ignored. It will export every single data from the sheet to CSV format.
\nFor example: If you have some blank rows at the beginning of the sheet etc., which you do not want to save it in CSV, it is not possible to ignore them. It will still save those lines as blank values in the CSV.<\/p>\n

Best case when it should be used?<\/h2>\n

This is the best option, when your excel sheet has, the only data which you want to export it as a CSV file. That means it does not have any other data which you want to ignore while exporting it to csv.<\/p>\n

VBA Code<\/h2>\n
\r\nSub saveSheetToCSV()\r\n    \r\n    Dim myCSVFileName As String\r\n    Dim tempWB As Workbook\r\n    \r\n    Application.DisplayAlerts = False\r\n    On Error GoTo err\r\n    \r\n    myCSVFileName = ThisWorkbook.Path & \"\\\" & \"CSV-Exported-File-\" & VBA.Format(VBA.Now, \"dd-MMM-yyyy hh-mm\") & \".csv\"\r\n\r\n    ThisWorkbook.Sheets(\"YourSheetToCopy\").Activate\r\n    ActiveSheet.Copy\r\n    Set tempWB = ActiveWorkbook\r\n    \r\n    With tempWB\r\n    .SaveAs Filename:=myCSVFileName, FileFormat:=xlCSV, CreateBackup:=False\r\n    .Close\r\n    End With\r\nerr:\r\n    Application.DisplayAlerts = True\r\nEnd Sub\r\n<\/code><\/pre>\n

Explanation of the Code<\/h2>\n

This method is simply using the SaveAs feature of ActiveSheet to CSV format. Rest is self explanatory.<\/p>\n

<\/a><\/p>\n

2. VBA to Export Specific Range to CSV – Method 1<\/h1>\n

Advantages of this method<\/h2>\n

This method overcomes both the challenges of the first Method.
\n1. Here you have full control over which all data you want to be part of your CSV file.
\n2. You can read data from random places and even from different sheets as well.
\n3. You can use your own delimiter – For example: <\/strong> instead of comma, you may use semicolon(;)<\/p>\n

Drawbacks of this Method<\/h2>\n

1. The only shortcoming with this method, as compared to first method, is it has few more lines of code and execution time will be more because you are reading data for each row and column and putting them together in CSV file – separating them by comma.<\/p>\n

Best case when it should be used?<\/h2>\n

1. When your data is scattered
\n2. You want to have control over data (Format check, some transformation logic etc.)<\/p>\n

VBA Codes<\/h2>\n
\r\nSub exportRangeToCSVFile()\r\n    \r\n    Dim myCSVFileName As String\r\n    Dim myWB As Workbook\r\n    Dim rngToSave As Range\r\n    Dim fNum As Integer\r\n    Dim csvVal As String\r\n    \r\n    Set myWB = ThisWorkbook\r\n    myCSVFileName = myWB.Path & \"\\\" & \"CSV-Exported-File-\" & VBA.Format(VBA.Now, \"dd-MMM-yyyy hh-mm\") & \".csv\"\r\n    csvVal = \"\"\r\n    fNum = FreeFile\r\n    Set rngToSave = Range(\"B2:H30\")\r\n    \r\n    Open myCSVFileName For Output As #fNum\r\n    \r\n    For i = 1 To rngToSave.Rows.Count\r\n        For j = 1 To rngToSave.Columns.Count\r\n            csvVal = csvVal & Chr(34) & rngToSave(i, j).Value & Chr(34) & \",\"\r\n        Next\r\n        Print #fNum, Left(csvVal, Len(csvVal) - 2)\r\n        csvVal = \"\"\r\n    Next\r\n    \r\n    Close #fileNumber\r\nEnd Sub\r\n<\/code><\/pre>\n

Explanation of above Code<\/h2>\n

In above code, I am doing the following:
\n1. It is a simple for loop, using which I am concatenating each row and columns data separated by comma (,)
\n2. Print each rows data in csv file.
\n3. That’s all… your csv file is ready to use<\/p>\n

<\/a><\/p>\n

3. VBA to Export excel Range or Table to csv – Method 2<\/h1>\n

If you want a specific range or Table to be exported as CSV from a Worksheet, which has lot more other data as well that you want to ignore, then this method should be used. Most importantly data is huge and chances are that your data might have comma (,) or double quotes (” “) as part of values.<\/em><\/p>\n

How this method works?<\/h2>\n

Step 1: Copy the Range or Table data in to a New WorkSheetat Cell A1
\nStep 2: Now this new Worksheet has “the only data” which you want to save as CSV, therefore, apply method 1 and saveAs this WorkSheet as CSV file.<\/p>\n

Best case when it should be used?<\/h2>\n

1. When you have a clear range of data which you want to export as csv
\n2. Data is large enough.
\n3. When there are chances that your data might have comma or double quotes as a value<\/strong><\/p>\n

VBA Code<\/h2>\n
\r\nSub saveRangeToCSV()\r\n\t\r\n\tDim myCSVFileName As String\r\n\tDim myWB As Workbook\r\n\tDim tempWB As Workbook\r\n\tDim rngToSave As Range\r\n\t\r\n\tApplication.DisplayAlerts = False\r\n\tOn Error GoTo err\r\n\t\r\n\tSet myWB = ThisWorkbook\r\n\tmyCSVFileName = myWB.Path & \"\\\" & \"CSV-Exported-File-\" & VBA.Format(VBA.Now, \"dd-MMM-yyyy hh-mm\") & \".csv\"\r\n\t\r\n\tSet rngToSave = Range(\"C3:H50\")\r\n\trngToSave.Copy\r\n\t\r\n\tSet tempWB = Application.Workbooks.Add(1)\r\n\tWith tempWB\r\n\t\t.Sheets(1).Range(\"A1\").PasteSpecial xlPasteValues\r\n\t\t.SaveAs Filename:=myCSVFileName, FileFormat:=xlCSV, CreateBackup:=False\r\n\t\t.Close\r\n\tEnd With\r\n\terr:\r\n\tApplication.DisplayAlerts = True\r\nEnd Sub\r\n<\/code><\/pre>\n

VBA Code Explanation<\/h2>\n

Above VBA Code is doing the followings:
\n1. Copy the Range from your Excel Sheet – rngToSave <\/strong>
\n2. Create a new Excel Workbook
\n3. Paste the Copied range data in to the first sheet of the workbook from A1 cell – .Sheets(1).Range(“A1”).PasteSpecial xlPasteValues<\/strong>
\n4. SaveAs this new workbook as CSV file
\n5. You are done Now \ud83d\ude42<\/p>\n

<\/a><\/p>\n

4. VBA to Export excel Table to CSV format<\/h1>\n

This is the simplest method to save an excel table to CSV format. Most importantly – your data must NOT have comma (,) as part of values.<\/em> In such case, you should use above method – 3.<\/p>\n

VBA for saving Excel Table as CSV<\/h2>\n
\r\nSub saveTableToCSV()\r\n\t\r\n\tDim tbl As ListObject\r\n\tDim csvFilePath As String\r\n\tDim fNum As Integer\r\n\tDim tblArr\r\n\tDim rowArr\r\n\tDim csvVal\r\n\r\n\tSet tbl = Worksheets(\"YourSheetName\").ListObjects(\"YourTableName\")\r\n\tcsvFilePath = \"C:\\Users\\vmishra\\Desktop\\CSVFile.csv\"\r\n\ttblArr = tbl.DataBodyRange.Value\r\n\t\r\n\tfNum = FreeFile()\r\n\tOpen csvFilePath For Output As #fNum\r\n\tFor i = 1 To UBound(tblArr)\r\n\t\trowArr = Application.Index(tblArr, i, 0)\r\n\t\tcsvVal = VBA.Join(rowArr, \",\")\r\n\t\tPrint #1, csvVal\r\n\tNext\r\n\tClose #fNum\r\n\tSet tblArr = Nothing\r\n\tSet rowArr = Nothing\r\n\tSet csvVal = Nothing\r\nEnd Sub\r\n<\/code><\/pre>\n

Explanation about the VBA Code above<\/h2>\n

Above code is doing the following
\n1. Storing the whole content of your table into a two dimensional array – tblArr<\/strong>
\n2. For each row – extract the data in to one dimensional array rowArr<\/strong>
\n3. Join all the data of single dimensional array by using comma as delimiter and store it in to a variable – csvVal <\/strong>
\n4. Print this comma separated data in the csv file (which was created)
\n5. Repeat this process for each row of the table – For loop is used to do so<\/strong><\/p>\n

\n

<\/i> I have tried covering all possible methods to export your excel data to CSV format.
\nI would really appreciate, if you provide your feedback. Do let me know by writing your comment here in the comment section of this article.<\/p>\n<\/div>\n

\n

Did you like this article? <\/h3>\n\n

Then share it with your friends\u2026 spread knowledge…Learn All about interacting with Text Files in Excel VBA like opening, creating, writing, reading etc. from Text Files using Excel VBA code\n<\/p><\/div>\n<\/span>","protected":false},"excerpt":{"rendered":"

In this article, I am going to teach you 4 VBA Methods of – how to export data from Excel Range to a CSV file format using Excel VBA. \u00a0 Did you know? CSV is an abbreviation of Comma Separated Value. As the name suggests, it is clear that this file stores the tabular data […]<\/p>\n","protected":false},"author":45,"featured_media":14249,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[1246,1675,1676],"tags":[],"class_list":["post-14228","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-macro","category-excel-macro-for-beginners","category-excel-tips"],"yoast_head":"\nVBA Methods - To Export Excel Range, Table, Sheets as CSV File<\/title>\n<meta name=\"description\" content=\"Excel macro to save range as CSV file. VBA to export excel data to csv format. Export excel table to CSV format using Excel VBA. VBA to save range as CSV file\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/vmlogger.com\/excel\/2017\/09\/save-excel-range-data-as-csv-file-through-excel-vba\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Top 4 VBA Methods to Export Excel data as CSV File\" \/>\n<meta property=\"og:description\" content=\"Excel macro to save range as CSV file. VBA to export excel data to csv format. Export excel table to CSV format using Excel VBA. VBA to save range as CSV file\" \/>\n<meta property=\"og:url\" content=\"https:\/\/vmlogger.com\/excel\/2017\/09\/save-excel-range-data-as-csv-file-through-excel-vba\/\" \/>\n<meta property=\"og:site_name\" content=\"Let's excel in Excel\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/www.facebook.com\/vmlogger\" \/>\n<meta property=\"article:author\" content=\"http:\/\/www.facebook.com\/vmlogger\" \/>\n<meta property=\"article:published_time\" content=\"2017-09-02T13:35:55+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-08-09T19:35:46+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2017\/09\/Export-excel-data-to-csv-2.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"538\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Vishwamitra Mishra\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/www.twitter.com\/learnexcelmacro\" \/>\n<meta name=\"twitter:site\" content=\"@learnexcelmacro\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Vishwamitra Mishra\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/vmlogger.com\/excel\/2017\/09\/save-excel-range-data-as-csv-file-through-excel-vba\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/2017\/09\/save-excel-range-data-as-csv-file-through-excel-vba\/\"},\"author\":{\"name\":\"Vishwamitra Mishra\",\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5\"},\"headline\":\"Top 4 VBA Methods to Export Excel data as CSV File\",\"datePublished\":\"2017-09-02T13:35:55+00:00\",\"dateModified\":\"2022-08-09T19:35:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/2017\/09\/save-excel-range-data-as-csv-file-through-excel-vba\/\"},\"wordCount\":1134,\"commentCount\":27,\"publisher\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5\"},\"image\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/2017\/09\/save-excel-range-data-as-csv-file-through-excel-vba\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2017\/09\/Export-excel-data-to-csv-2.jpg\",\"articleSection\":[\"Excel Macro\",\"Excel Macro Tutorial\",\"Excel Tips\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/vmlogger.com\/excel\/2017\/09\/save-excel-range-data-as-csv-file-through-excel-vba\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/vmlogger.com\/excel\/2017\/09\/save-excel-range-data-as-csv-file-through-excel-vba\/\",\"url\":\"https:\/\/vmlogger.com\/excel\/2017\/09\/save-excel-range-data-as-csv-file-through-excel-vba\/\",\"name\":\"VBA Methods - To Export Excel Range, Table, Sheets as CSV File\",\"isPartOf\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/2017\/09\/save-excel-range-data-as-csv-file-through-excel-vba\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/2017\/09\/save-excel-range-data-as-csv-file-through-excel-vba\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2017\/09\/Export-excel-data-to-csv-2.jpg\",\"datePublished\":\"2017-09-02T13:35:55+00:00\",\"dateModified\":\"2022-08-09T19:35:46+00:00\",\"description\":\"Excel macro to save range as CSV file. VBA to export excel data to csv format. Export excel table to CSV format using Excel VBA. VBA to save range as CSV file\",\"breadcrumb\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/2017\/09\/save-excel-range-data-as-csv-file-through-excel-vba\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/vmlogger.com\/excel\/2017\/09\/save-excel-range-data-as-csv-file-through-excel-vba\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/vmlogger.com\/excel\/2017\/09\/save-excel-range-data-as-csv-file-through-excel-vba\/#primaryimage\",\"url\":\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2017\/09\/Export-excel-data-to-csv-2.jpg\",\"contentUrl\":\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2017\/09\/Export-excel-data-to-csv-2.jpg\",\"width\":800,\"height\":538,\"caption\":\"Export-excel-data-to-csv\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/vmlogger.com\/excel\/2017\/09\/save-excel-range-data-as-csv-file-through-excel-vba\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/vmlogger.com\/excel\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Excel Macro\",\"item\":\"https:\/\/vmlogger.com\/excel\/macro\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Top 4 VBA Methods to Export Excel data as CSV File\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/vmlogger.com\/excel\/#website\",\"url\":\"https:\/\/vmlogger.com\/excel\/\",\"name\":\"Let's excel in Excel\",\"description\":\"Let's share knowledge\",\"publisher\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/vmlogger.com\/excel\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5\",\"name\":\"Vishwamitra Mishra\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2022\/07\/avataaars-1.png\",\"contentUrl\":\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2022\/07\/avataaars-1.png\",\"width\":528,\"height\":560,\"caption\":\"Vishwamitra Mishra\"},\"logo\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/image\/\"},\"description\":\"My name is Vishwamitra Mishra. Friends Call me Vishwa. I hold a Bachelor\u2019s Degree in Computer Science from D.A.V.V. Indore & currently working as a Technical Lead having over 7 years of experience.\",\"sameAs\":[\"http:\/\/www.learnexcelmacro.com\",\"http:\/\/www.facebook.com\/vmlogger\",\"https:\/\/x.com\/https:\/\/www.twitter.com\/learnexcelmacro\",\"https:\/\/www.youtube.com\/c\/VMLogger\"],\"url\":\"https:\/\/vmlogger.com\/excel\/author\/vishwamitra\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"VBA Methods - To Export Excel Range, Table, Sheets as CSV File","description":"Excel macro to save range as CSV file. VBA to export excel data to csv format. Export excel table to CSV format using Excel VBA. VBA to save range as CSV file","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/vmlogger.com\/excel\/2017\/09\/save-excel-range-data-as-csv-file-through-excel-vba\/","og_locale":"en_US","og_type":"article","og_title":"Top 4 VBA Methods to Export Excel data as CSV File","og_description":"Excel macro to save range as CSV file. VBA to export excel data to csv format. Export excel table to CSV format using Excel VBA. VBA to save range as CSV file","og_url":"https:\/\/vmlogger.com\/excel\/2017\/09\/save-excel-range-data-as-csv-file-through-excel-vba\/","og_site_name":"Let's excel in Excel","article_publisher":"http:\/\/www.facebook.com\/vmlogger","article_author":"http:\/\/www.facebook.com\/vmlogger","article_published_time":"2017-09-02T13:35:55+00:00","article_modified_time":"2022-08-09T19:35:46+00:00","og_image":[{"width":800,"height":538,"url":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2017\/09\/Export-excel-data-to-csv-2.jpg","type":"image\/jpeg"}],"author":"Vishwamitra Mishra","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/www.twitter.com\/learnexcelmacro","twitter_site":"@learnexcelmacro","twitter_misc":{"Written by":"Vishwamitra Mishra","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/vmlogger.com\/excel\/2017\/09\/save-excel-range-data-as-csv-file-through-excel-vba\/#article","isPartOf":{"@id":"https:\/\/vmlogger.com\/excel\/2017\/09\/save-excel-range-data-as-csv-file-through-excel-vba\/"},"author":{"name":"Vishwamitra Mishra","@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5"},"headline":"Top 4 VBA Methods to Export Excel data as CSV File","datePublished":"2017-09-02T13:35:55+00:00","dateModified":"2022-08-09T19:35:46+00:00","mainEntityOfPage":{"@id":"https:\/\/vmlogger.com\/excel\/2017\/09\/save-excel-range-data-as-csv-file-through-excel-vba\/"},"wordCount":1134,"commentCount":27,"publisher":{"@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5"},"image":{"@id":"https:\/\/vmlogger.com\/excel\/2017\/09\/save-excel-range-data-as-csv-file-through-excel-vba\/#primaryimage"},"thumbnailUrl":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2017\/09\/Export-excel-data-to-csv-2.jpg","articleSection":["Excel Macro","Excel Macro Tutorial","Excel Tips"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/vmlogger.com\/excel\/2017\/09\/save-excel-range-data-as-csv-file-through-excel-vba\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/vmlogger.com\/excel\/2017\/09\/save-excel-range-data-as-csv-file-through-excel-vba\/","url":"https:\/\/vmlogger.com\/excel\/2017\/09\/save-excel-range-data-as-csv-file-through-excel-vba\/","name":"VBA Methods - To Export Excel Range, Table, Sheets as CSV File","isPartOf":{"@id":"https:\/\/vmlogger.com\/excel\/#website"},"primaryImageOfPage":{"@id":"https:\/\/vmlogger.com\/excel\/2017\/09\/save-excel-range-data-as-csv-file-through-excel-vba\/#primaryimage"},"image":{"@id":"https:\/\/vmlogger.com\/excel\/2017\/09\/save-excel-range-data-as-csv-file-through-excel-vba\/#primaryimage"},"thumbnailUrl":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2017\/09\/Export-excel-data-to-csv-2.jpg","datePublished":"2017-09-02T13:35:55+00:00","dateModified":"2022-08-09T19:35:46+00:00","description":"Excel macro to save range as CSV file. VBA to export excel data to csv format. Export excel table to CSV format using Excel VBA. VBA to save range as CSV file","breadcrumb":{"@id":"https:\/\/vmlogger.com\/excel\/2017\/09\/save-excel-range-data-as-csv-file-through-excel-vba\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/vmlogger.com\/excel\/2017\/09\/save-excel-range-data-as-csv-file-through-excel-vba\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/vmlogger.com\/excel\/2017\/09\/save-excel-range-data-as-csv-file-through-excel-vba\/#primaryimage","url":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2017\/09\/Export-excel-data-to-csv-2.jpg","contentUrl":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2017\/09\/Export-excel-data-to-csv-2.jpg","width":800,"height":538,"caption":"Export-excel-data-to-csv"},{"@type":"BreadcrumbList","@id":"https:\/\/vmlogger.com\/excel\/2017\/09\/save-excel-range-data-as-csv-file-through-excel-vba\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/vmlogger.com\/excel\/"},{"@type":"ListItem","position":2,"name":"Excel Macro","item":"https:\/\/vmlogger.com\/excel\/macro\/"},{"@type":"ListItem","position":3,"name":"Top 4 VBA Methods to Export Excel data as CSV File"}]},{"@type":"WebSite","@id":"https:\/\/vmlogger.com\/excel\/#website","url":"https:\/\/vmlogger.com\/excel\/","name":"Let's excel in Excel","description":"Let's share knowledge","publisher":{"@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/vmlogger.com\/excel\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5","name":"Vishwamitra Mishra","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/image\/","url":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2022\/07\/avataaars-1.png","contentUrl":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2022\/07\/avataaars-1.png","width":528,"height":560,"caption":"Vishwamitra Mishra"},"logo":{"@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/image\/"},"description":"My name is Vishwamitra Mishra. Friends Call me Vishwa. I hold a Bachelor\u2019s Degree in Computer Science from D.A.V.V. Indore & currently working as a Technical Lead having over 7 years of experience.","sameAs":["http:\/\/www.learnexcelmacro.com","http:\/\/www.facebook.com\/vmlogger","https:\/\/x.com\/https:\/\/www.twitter.com\/learnexcelmacro","https:\/\/www.youtube.com\/c\/VMLogger"],"url":"https:\/\/vmlogger.com\/excel\/author\/vishwamitra\/"}]}},"_links":{"self":[{"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/posts\/14228"}],"collection":[{"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/users\/45"}],"replies":[{"embeddable":true,"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/comments?post=14228"}],"version-history":[{"count":0,"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/posts\/14228\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/media\/14249"}],"wp:attachment":[{"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/media?parent=14228"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/categories?post=14228"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/tags?post=14228"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}