Jump to content

Need Help Inserting Double or Single Quotes


$Three3

Recommended Posts

Hi everyone, I have a long list of names that I need to have quotes around (it can be double or single quotes) and I have about 8,000 of them. I have them in Excel without any quotes and I can copy all of the names and paste them no problem but there are still no quotes. I have looked and looked for an Excel formula to add quotes to the name in each row but I have had no luck. I have also tried some clever find and replace techniques but no have worked either. The format I am looking for is this:

 

"Allen" or 'Allen'

 

Any of those would work. I need this so I can store the info into a database. Any help is greatly appreciated. Thanks

 

 

 

PS:

 

I have found other people online needing the same thing done that I need done and this solution has worked for them but I do not know what do with it:

 

You can fix it by using a range variable (myCell for example) and then use that to iterate the 'selection' collection of range objects, like so

Sub AddQuote()
Dim myCell As Range
    For Each myCell In Selection
        If myCell.Value <> "" Then
            myCell.Value = Chr(34) & myCell.Value
        End If
    Next myCell
End Sub

 

 

Another solution that also worked for others was:

 

Sub OneUglyExport()

Dim FileToSave, c As Range, OneBigOleString As String

FileToSave = Application.GetSaveAsFilename

Open FileToSave For Output As #1

For Each c In Selection

    If Len(c.Text) <> 0 Then _

        OneBigOleString = OneBigOleString & ", " & Chr(34) & Trim(c.Text) & Chr(34)

Next

Print #1, Mid(OneBigOleString, 3, Len(OneBigOleString))

Close #1

End Sub

Link to comment
Share on other sites

I'm afraid i'm doubtful you will get any help with vbscript.

 

If you Export you database from excel to a "CSV", then do a quick google search on "PHP CSV Edit Tutorial".

 

That should get you started - assuming you actually have a PHP server to test it on, or know what that is where to get it.

 

-cb-

Link to comment
Share on other sites

the code you have found is not written in PHP, it looks to be vb, C# or another language.

 

a quick google found this PHP excel reader

http://sourceforge.net/projects/phpexcelreader/

I'm sure if you play around with that you could insert the spreadsheet values into a database, or as ChemicalBliss has said - converting the spreadsheet to a CSV would also be viable.

good luck.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.