+ Reply to Thread
Results 1 to 4 of 4

Forcing quotation marks around strings

Hybrid View

  1. #1
    Registered User
    Join Date
    06-06-2007
    Posts
    2

    Forcing quotation marks around strings

    My manager has a work sheet with strings like pol_ID, quantity, extact_dt.
    He wants to force excel to put quotations around any strings so that when he saves the .xls as a .csv and then opens the file in notepad, the quotation marks will be there.

    So what he wants is "pol_ID", "quantity", "extact_dt"

    Does anyone know if this is possible, and how to accomplish it?

    Thanks

  2. #2
    Registered User
    Join Date
    05-12-2007
    Posts
    24
    If all the strings are in the same column, you could make a new column adjacent to it which adds the " s.
    So if the first string 'quantity' (but with no quotation marks!) was in A1, if you put =""""&A1&"""" in B1 you would get "quantity". You could then maybe copy and Paste Special values back over column A to replace it with column B.

  3. #3
    Registered User
    Join Date
    06-06-2007
    Posts
    2
    Actually, the strings aren't all in one column. They are column headings, and there are usually several dozen columns in the spreadsheets.

    Do you know if there is a property setting in Excel, that would put quotations around these heading?

    Thanks

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    This code would put them around individual words

    http://www.contextures.com/xlvba01.html#Regular

    Sub Macro1()
    
    Dim Cell As Range
    For Each Cell In Selection
    Cell.Value = """" & Cell.Value & """"
      Next Cell
    End Sub
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1