ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Replace in VBA Excel (https://www.excelbanter.com/excel-programming/271690-replace-vba-excel.html)

Maurice[_2_]

Replace in VBA Excel
 
In Visual basic you can use the Replace function to remove
unwanted characters. What would you use in VBA tom
accomplish the same. When I try to use the replace
function, it gives an error "Sub or function is not
defined"
Maurice

Chip Pearson

Replace in VBA Excel
 
Maurice,

Replace was added to VBA in version 6, or Excel 2000, so it is not
available in earlier versions. In its place, you can use

Result = Application.WorksheetFunction.Substitute(...)

to call the SUBSTITUTE worksheet function from within VBA. See
help in Excel for SUBSTITUTE for syntax details.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Maurice" wrote in message
...
In Visual basic you can use the Replace function to remove
unwanted characters. What would you use in VBA tom
accomplish the same. When I try to use the replace
function, it gives an error "Sub or function is not
defined"
Maurice




Maurice[_3_]

Replace in VBA Excel
 
Thanks,
That did it for me!!!!
Maurice

-----Original Message-----
Maurice,

Replace was added to VBA in version 6, or Excel 2000, so

it is not
available in earlier versions. In its place, you can use

Result = Application.WorksheetFunction.Substitute(...)

to call the SUBSTITUTE worksheet function from within

VBA. See
help in Excel for SUBSTITUTE for syntax details.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Maurice" wrote in message
...
In Visual basic you can use the Replace function to

remove
unwanted characters. What would you use in VBA tom
accomplish the same. When I try to use the replace
function, it gives an error "Sub or function is not
defined"
Maurice



.



All times are GMT +1. The time now is 08:40 PM.

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