ReplNameChar = Application.WorksheetFunction.Substitute
(ReplNameChar, "&", "_and_") ' remove &
TIA
myArray = Array ("&","/","\","^")
For i = LBound(myArray) To UBound(myArray)
ReplNameChar = Application.WorksheetFunction.Substitute
(ReplNameChar, myArray(i), "_and_") ' remove &
Next i
--
HTH
Bob Phillips
"mel" <anon...@discussions.microsoft.com> wrote in message
news:5a3801c523d6$96b31760$a401...@phx.gbl...
You would have to write your own User Defined Function.
newString = translate(oldString, toString, fromString)
Function translate(oldString As String, toString As String, _
fromString As String) As String
'David McRitchie, 2005-03-08 programing
' http://groups.google.com/groups?threadm=5a3801c523d6%2496b31760%24a401280a%40phx.gbl
'limited to equal length from and to strings for now
'ref. http://mitvma.mit.edu/cmshelp.cgi?REXX%20TRANSLAT%20(ALL
Dim i As Long, pos As Long, str As String
str = ""
For i = 1 To Len(oldString)
'-- InStr([start, ]haystack, needle[, compare])
pos = InStr(1, fromString, Mid(oldString, i, 1), vbBinaryCompare)
If pos = 0 Then
str = str & Mid(oldString, i, 1)
Else
str = str & Mid(toString, i, 1)
End If
Next i
translate = str
End Function
--
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm
"Bob Phillips" <phil...@tiscali.co.uk> wrote in message news:%23gpCLq9...@TK2MSFTNGP10.phx.gbl...
Function translate(oldString As String, toString As String, _
fromString As String) As String
'David McRitchie, 2005-03-08 programing
' http://groups.google.com/groups?threadm=5a3801c523d6%2496b31760%24a401280a%40phx.gbl
'limited to equal length from and to strings for now
'ref. http://mitvma.mit.edu/cmshelp.cgi?REXX%20TRANSLAT%20(ALL
Dim i As Long, pos As Long, str As String
str = ""
For i = 1 To Len(oldString)
'InStr([start, ]haystack, needle[, compare])
pos = InStr(1, fromString, Mid(oldString, i, 1), vbBinaryCompare)
If pos = 0 Then
str = str & Mid(oldString, i, 1)
Else
str = str & Mid(toString, pos, 1) '-- corrected
TRANSLATE User Defined Function
"Simulate a mainframe type TRANSLATE function"
http://www.mvps.org/dmcritchie/excel/translate.htm
I have also put in some comments relating to the mess created by
groups-beta-google back in Nov. and how it keeps getting worse. The
code structure appears okay if you look at the original text in google
groups or in the actual thread in your newsbrowser, but it messed up
for those that look at Google Groups.
---
David McRitchie, Microsoft MVP - Excel