ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macro for deleting a particular string and inserting commas in it (https://www.excelbanter.com/excel-programming/431662-macro-deleting-particular-string-inserting-commas.html)

Purple

macro for deleting a particular string and inserting commas in it
 
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

joel

macro for deleting a particular string and inserting commas in it
 
mystr = "Yes TAX Invoicing No multi purpose Yes summer time No tuna tub"
myarray = Split(mystr, " ")
myoutput = myarray(1) & " " & myarray(2) & ", " & myarray(6) & " " &
myarray(7)

"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


Sam Wilson

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



All times are GMT +1. The time now is 08:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com