|
|
On Mon, 06 Dec 2004 11:30:08 -0800, lid
(hrlngrv - ExcelForums.com) wrote:
Adequate for the OP's sample data, but if you're going to write a
udf, it might as well be as general as possible.
For literal, possibly multiple character separator strings,
Well, if you are going to go beyond the OP's request, and make it as general as
possible, you should allow for zero-length separator strings also.
===================================
Function Rev(str As String, Optional sep) As String
Dim temp, temp1
Dim i As Integer
If Not IsMissing(sep) Then
str = Replace(str, sep, Chr(255))
temp = Split(str, Chr(255))
ReDim temp1(UBound(temp))
For i = 0 To UBound(temp)
temp1(UBound(temp) - i) = temp(i)
Next i
Rev = Join(temp1, sep)
Else
Rev = StrReverse(str)
End If
End Function
===============================
And, if the OP has an earlier version of Excel with a version of VB prior to
VB6, he may emulate the VB6 string functions by the method shown in
http://support.microsoft.com/default...b;en-us;188007
--ron
|