ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Replace in Excel 97 (https://www.excelbanter.com/excel-programming/293336-replace-excel-97-a.html)

pcw[_2_]

Replace in Excel 97
 

I used the Replace function in my code while developing in
Excel XP. However, it comes back with an error when I try
to run it in Excel 97.

Is there an equivalent to the Replace function in Excel 97?
Note: this is not being used in the formula bar.

[email protected]

Replace in Excel 97
 
HOWTO: Simulate Visual Basic 6.0 String Functions in VB5
http://support.microsoft.com/default...b;EN-US;188007

HTH
Paul
--------------------------------------------------------------------------------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
--------------------------------------------------------------------------------------------------------------


I used the Replace function in my code while developing in
Excel XP. However, it comes back with an error when I try
to run it in Excel 97.

Is there an equivalent to the Replace function in Excel 97?
Note: this is not being used in the formula bar.



Bob Phillips[_6_]

Replace in Excel 97
 
No, Replace came in in XL2000.

You can write your own though

Function Replace97(Source As String, Find As String, Replace As String)
Dim iPos As Long
Dim sTemp As String

sTemp = Source
Do
iPos = InStr(sTemp, Find)
sTemp = Left(sTemp, iPos - 1) & Replace & Right(sTemp, Len(sTemp) -
Len(Find) - iPos + 1)
Loop Until InStr(sTemp, Find) = 0
Replace97 = sTemp
End Function


or you could use the worksheet substitute function

Debug.Print Application.Substitute("Bob", "o", "a")

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"pcw" wrote in message
...

I used the Replace function in my code while developing in
Excel XP. However, it comes back with an error when I try
to run it in Excel 97.

Is there an equivalent to the Replace function in Excel 97?
Note: this is not being used in the formula bar.





All times are GMT +1. The time now is 03:02 AM.

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