Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting commas slezama Excel Discussion (Misc queries) 1 April 18th 09 02:46 PM
String separated with commas Jarle Excel Programming 5 February 28th 08 12:41 AM
Inserting and deleting spaces with a macro crowdx42[_18_] Excel Programming 7 August 22nd 06 05:19 PM
removing commas from a string TheIrishThug[_3_] Excel Programming 4 December 18th 05 05:50 PM
Excel – Macro Problem – Inserting, Appending Data, Deleting Aussiexcel[_3_] Excel Programming 0 August 25th 04 07:48 AM


All times are GMT +1. The time now is 07:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"