View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Sam Wilson Sam Wilson is offline
external usenet poster
 
Posts: 523
Default macro for deleting a particular string and inserting commas in it

Function Splicer(myStr As String) As String

Dim aStr() As String
aStr = Split(myStr, " ")

Dim bInc As Boolean
bInc = True

Dim i As Integer
For i = 0 To UBound(aStr)

Select Case aStr(i)
Case "Yes"
bInc = True

Case "No"
bInc = False

Case Else
If bInc = True Then Splicer = Splicer & " " & aStr(i)

End Select

Next i

Splicer = Trim(Splicer)

End Function

"Purple" wrote:

Hi,
I need a MACRO FOR THIS URGENTLY
I have a long string namely: Yes TAX Invoicing No multi purpose Yes summer
time No tuna tub
The yes and No option varies from a row to row
i Want a Particular Output deleting ALL the NO's and the particular string
after no and all yes should appear in the row with proper commas
Desired OUTPUT:
TAX Invoicing, Summer time
--
Purple