Results 1 to 4 of 4

Thread: How to delete change keywords separated by comma into a cell?

  1. #1

    Question How to delete change keywords separated by comma into a cell?

    Register for a FREE account, and/
    or Log in to avoid these ads!

    Hi folks, nice to meet you all.

    Lets suppose I have the cell A1 with 100 words or more separated by comma, but the words can be composed word or double words such as "jump up", "Old age","sunny day", or more "holding a face", but I want to find these composed words or double/triple+ words with space that are between commas, and put them between double-quotes.

    So, as example let's suppose my cell A1 was as:
    [A1] word1, jump up, word3, word4, Old age, word6, Sunny day, holding a face,...word100

    Want the result as

    [A1] word1, "jump up", word3, word4, "Old age", word6, "Sunny day", "holding a face",...word100

    It can be a formula on B1 or a trick by using find&replace.

    Thanks in advance.

  2. #2
    Dim vItems As Variant, vItem As Variant
    Dim i As Long
        With ActiveCell
            vItems = Split(.Value, ",")
            For i = LBound(vItems) To UBound(vItems)
                vItems(i) = Trim(vItems(i))
                If InStr(vItems(i), " ") > 0 Then
                    vItems(i) = Chr(34) & vItems(i) & Chr(34)
                End If
            Next i
            .Value = Join(vItems, ",")
        End With

  3. #3
    Hi Bob, thanks for your reply. I'm sorry but I'm newbie with VBA, Macro stuffs, and it seems a VBA, right?
    What I remember I hit ALT+F11 and paste the code in VBA/Macro, but I forgot how do I call this code in the cell B1?


  4. #4
    You just run it, you don't run it in a cell.

Tags for this Thread

Posting Permissions

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