Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Inserting commas | Excel Discussion (Misc queries) | |||
String separated with commas | Excel Programming | |||
Inserting and deleting spaces with a macro | Excel Programming | |||
removing commas from a string | Excel Programming | |||
Excel – Macro Problem – Inserting, Appending Data, Deleting | Excel Programming |