Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6140109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:04:31+00:00 2026-05-23T18:04:31+00:00

I have an excel workbook where the .csv file is outputted with quotes with

  • 0

I have an excel workbook where the .csv file is outputted with quotes with this vba code:

 'Set up Delimiters
DELIMITER = ","
QUOTE = """"

 'Set up file to save, ask user for name
GetFileName = InputBox("Enter Name for semi-colon delimited file: (Do not enter file extension)", "FILENAME")
  'CurrentPath = Application.ActiveWorkbook.Path
 PathtoUse = "C:\Users\David\Desktop\"
 FileNametoUse = PathtoUse & GetFileName & ".csv"

 'Find cells to cycle through
With ActiveSheet.UsedRange
    LastRow = .Cells(.Cells.Count).Row
    LastCol = .Cells(.Cells.Count).Column
End With

 'Assign a handle to next file#
FileNum = FreeFile

 'Open and write to file named above
Open FileNametoUse For Output As #FileNum

 'Cycle through rows and cols
For Each CurrentRow In Range("A1:A" & LastRow)
    With CurrentRow 'Now cycle through each cell in the row
        For Each CurrentCell In Range(.Cells, Cells(.Row, LastCol))
             'If the cell contains Non-Numeric (IsNumeric=False) then put quotes around the info
            If IsNumeric(CurrentCell.Text) = False Then
                CellData = QUOTE & CurrentCell.Text & QUOTE
            Else 'The cell contains numeric, use contents as is
                CellData = CurrentCell.Text
            End If
             'as the code cycles, keep adding each col info to string
            LineOutput = LineOutput & DELIMITER & CellData
        Next CurrentCell

         'Remove the first 2 chars in the line (since the delimiter is put in first)
        LineOutput = Mid(LineOutput, 2)
         'Print the line to the file
        Print #FileNum, LineOutput
          'Clear out the variable
        LineOutput = Empty
    End With
Next CurrentRow

 'Close the file
Close #FileNum

This outputs the file correctly for example:

"FirstName","Surname","YBC","BTBA","JTE","EnteringAverage","DOB","Game1","Game2","Game3","Game4","Game5","Game6","Game7","Game8","IndividualTotal","Average","TeamTotal"
"David","Passmore","Bowlplex Poole",116016,193,179,"05/08/1994",203,254,211,195,187,184,200,267,1701,212.63,3178
"Callum","Bailey","Bowlplex Poole",016015,185,189,"30/05/1996",175,145,195,117,201,265,221,158,1477,184.63,3178
"","","","","","","","","","","","","","","","","",""
"","","","","","","","","","","","","","","","","",""
"","","","","","","","","","","","","","","","","",""
"","","","","","","","","","","","","","","","","",""
"","","","","","","","","","","","","","","","","",""
"","","","","","","","","","","","","","","","","",""
"","","","","","","","","","","","","","","","","",""
"","","","","","","","","","","","","","","","","",""
"","","","","","","","","","","","","","","","","",""
"","","","","","","","","","","","","","","","","",""
"","","","","","","","","","","","","","","","","",""
"","","","","","","","","","","","","","","","","",""
"","","","","","","","","","","","","","","","","",""
"","","","","","","","","","","","","","","","","",""
"","","","","","","","","","","","","","","","","",""
"","","","","","","","","","","","","","","","","",""
"","","","","","","","","","","","","","","","","",""
"","","","","","","","","","","","","","","","","",""
"","","","","","","","","","","","","","","","","",""
"","","","","","","","","","","","","","","","","",""

Firstly I want to know how to remove all the blank cells, and secondly when I input this into phpMyAdmin it all works BUT it misses out the first column and it inputs the column names which I don’t want, so I want it to input all the first name column and then I want it to miss out the column names.

My server’s phpmyadmin version is 2.6.4 (I know its old but I can’t do anything about that)

But is also does this on my local server which is version 3.3.9

UPDATE

I’ve fixed the first column issue by just moving the file one column to the right so that’s fixed but the other two problems still exist.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T18:04:31+00:00Added an answer on May 23, 2026 at 6:04 pm

    You could just change your vba here:

     'Set up Delimiters 
    DELIMITER = "," 
    QUOTE = """"  
    

    To this:

    'Set up Delimiters
    DELIMITER = ";"
    QUOTE = """" 
    

    Because phpMyAdmin defaults to ; as the separator.

    In answser to your second point you could use this vba code to remove blank cells:

    Sub MacroNAME()
        ActiveWorkbook.Save
        Rows("1:1").Select
        Selection.Cut
        Sheets("sheetname").Select
        Sheets.Add
        ActiveSheet.Name = "Save"
        ActiveSheet.Paste
        Sheets("sheetname").Select
        Rows("1:1").Select
        Rows("1:1").RowHeight = 14.25
        Selection.Delete Shift:=xlUp
        Cells.Select
        Selection.SpecialCells(xlCellTypeBlanks).Select
        Selection.ClearContents
        Columns("A:A").Select
        Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Rows("1:1").Select
        Selection.Delete Shift:=xlUp
        Rows("2:2").RowHeight = 14.25
        **Code Used above here**
        Rows("1:1").Select
        Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
        Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
        Rows("1:1").RowHeight = 0.1
        Columns("A:A").Select
        Selection.Delete Shift:=xlToLeft
        Sheets("sheetname").Select
        Rows("2:2").Select
        Selection.Insert Shift:=xlDown
        Rows("1:1").RowHeight = 10.5
        Rows("1:1").RowHeight = 14.25
        Sheets("Save").Select
        Selection.Cut
        Sheets("sheetname").Select
        Rows("1:1").Select
        ActiveSheet.Paste
        Application.DisplayAlerts = False
        Sheets("Save").Select
        ActiveWindow.SelectedSheets.Delete
        Application.DisplayAlerts = True
    

    This will clear the column headings provided they are it the first row.

    You can apply this to a button and it should work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an excel workbook that uses VBA. This VBA works fine except when
I have an Excel file that has a bunch of VBA and macro code
I have an Excel workbook, which using VBA code that opens another workbook, copies
I have an Excel workbook with dependencies on code in other other Excel workbooks
We currently have an Excel spreadsheet containing a large amount of VBA code. The
I have more than twenty sheets in an Excel workbook (file). Is there some
How do I save each sheet in an Excel workbook to separate CSV files
How does one open a semicolon delimited CSV file with VBA in Excel 2000?
I would like to save my CSV file as unicode by using Excel. I
So I have this Excel workbook which basically is supposed to be a data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.