Sheet saved in CSV but all the data are in one column

Status
Not open for further replies.

Gwhaou

Board Regular
Joined
May 10, 2022
Messages
78
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Hi recently i tried by using one macro to save a particular sheet in CSV by asking the user the path and the name of the file that I want to save using Dialog box (Save As)

This is the code :

Public Sub Save_sheet_CSV()

Dim FileName As String
FileName = Application.GetSaveAsFilename(FileFilter:="Excel Files (*.csv), *.csv")

If FileName = "False" Then
MsgBox "No filename specified!", vbExclamation
Else
Sheets("DATA_SHEET").Select
ActiveSheet.Copy

Call Formatage_Export


Application.DisplayAlerts = False
ActiveWorkbook.SaveAs FileName:=FileName, FileFormat:=xlCSV
ActiveWorkbook.Close SaveChanges:=False
Application.DisplayAlerts = True

End If

End Sub

The specified sheet is correctly saved but, when i open the CSV file all the information are on the first column.
Is possible to fix that at the same time that the sheet is saving.
 

Attachments

  • Capture1.PNG
    Capture1.PNG
    8 KB · Views: 4
  • Capture2.PNG
    Capture2.PNG
    6.5 KB · Views: 5

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
import the CSV file rather than just open it, as in some countries local settings the default seperator can be ";" instead of a comma

You can cheack as follows:

Go to Start > Settings > Control Panel > Regional and Language Options.
Click “Customize”.
Enter “,” for “List Separator”
 
Upvote 0
Ok thank you so much for you help, i'm gonna do that right away 🙏
 
Upvote 0
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,215,202
Messages
6,123,625
Members
449,109
Latest member
Sebas8956

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top