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 ... |
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 ... |
All times are GMT +1. The time now is 06:10 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com