Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default String operations in VBA for "Substituite"?

What is the best way to code VBA for the associated SUBSTITUTE command in
cell formulas...

I want to delete a character from my string. I usually achieve this by
using
=SUBSTITUTE(²text²,²t²,²²)
Which returns ³ex² in a cell.

Unfortunately, this doesnıt go well in VBA ...
Perhaps the followoing?

For j = 1 to len(str)
If Mid(str, j, 1) = "t"
Πdelete the letter of the string?
Else??

Any ideas? Iım sure someone has done it before ...

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default String operations in VBA for "Substituite"?

Hi Brad,

If you're using Excel 2000 or later, check out the VBA Replace function.
In Excel 97 you can use the SUBSTITUTE worksheet function via
Application.WorksheetFunction.Substitute.

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"Brad Patterson" wrote in message
...
What is the best way to code VBA for the associated SUBSTITUTE command in
cell formulas...

I want to delete a character from my string. I usually achieve this by
using
=SUBSTITUTE(²text²,²t²,²²)
Which returns ³ex² in a cell.

Unfortunately, this doesnıt go well in VBA ...
Perhaps the followoing?

For j = 1 to len(str)
If Mid(str, j, 1) = "t"
O delete the letter of the string?
Else??

Any ideas? Iım sure someone has done it before ...



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
=SUBSTITUTE(C4,"~?#","") will this work to remove multiple string Raja Mahendiran S Excel Worksheet Functions 6 May 12th 10 09:10 PM
variable "speed" of excel operations Steve Excel Discussion (Misc queries) 3 February 3rd 10 06:36 PM
Converting "uppercase" string data to "lower case" in CSV file [email protected] Excel Discussion (Misc queries) 2 August 12th 08 08:36 PM
text string: "91E10" in csv file auto converts to: "9.10E+11" [email protected] Excel Discussion (Misc queries) 2 August 12th 08 03:13 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM


All times are GMT +1. The time now is 11:29 PM.

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"