I am not trying to redirect you away from Ron's solution (it is just that
I must be doing something wrong. When I paste your code into a new
module and try to run the macro there is nothing in the macro list.
My subroutine is not listed as a macro because it needs an argument passed
to it (which makes it a plain subroutine). I envisioned that you would be
using a Command Button or some worksheet event procedure to kick off the
code as opposed to simply running it from the Macro dialog. If you called it
from a Command Button's Click event or from within an event procedure, your
call would look like this...
GetQuotedText Range("A1")
or by using the currently selected cell...
GetQuotedText Selection
The subroutine only processes a single cell (that is where it differs from
Ron's), so if you specify a range containing more than one cell, the
subroutine won't do anything. If you want to be able to run it from the
dialog against the currently selected cell, try using this code instead...
Sub GetQuotedText()
Dim X As Long
Dim Index As Long
Dim QuotedText() As String
Dim PlacedText() As String
If Selection.Count > 1 Then Exit Sub
QuotedText = Split(Selection.Value, """")
If UBound(QuotedText) = -1 Then Exit Sub
ReDim PlacedText(UBound(QuotedText))
For X = 1 To UBound(QuotedText) Step 2
If UBound(Filter(PlacedText, QuotedText(X))) = -1 Then
PlacedText(X) = QuotedText(X)
Selection.Offset(Index, 1).Value = QuotedText(X)
Index = Index + 1
End If
Next
End Sub
Now it should appear in the Macro list. As with Ron's code, select the cell
you want to process and then execute the macro.
Note: I added an If-Then test immediately after the assignment line to
QuotedText in order to halt an error message that happens if a empty cell is
processed. If you chose to use my routine as originally designed (with the
argument), you should add this line in the same location to that orignal
code (for the same reason I added it here).
Which may be a reason to simply forget about my code and use his. It is more
flexible in that it will add rows to your spreadsheet in order to
accommodate the list it produces. I offered my solution, not only because it
used a non-RegEx approach, but also because it didn't affect the spreadsheet
by adding additional rows. Your original post wasn't clear if you wanted to
do that or not.
Rick