View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
delmac delmac is offline
external usenet poster
 
Posts: 30
Default find first o from right

HI Stefi, this is what i put in the module: when I use the
search(bytereverse)line a nothing happens at all: If I use the line Function
ByteReverse(InputString As String) As String I cant get past the the 1st line
when I step into the module:
If I use the code below I can step through the moduke but nothing happens
when I use the =SEARCH("0";ByteReverse(A1))
Am I missing anything at all: Thanks for all your help so far.
Public Function ByteReverse() As String
Dim i As Long
Dim ByteStr, ResultStr As String
ResultStr = ""
For i = Len(InputString) To 1 Step -1
ByteStr = Mid(InputString, i, 1)
ResultStr = ResultStr & ByteStr
Next i
ByteReverse = ResultStr
End Function

--
delmac


"Stefi" wrote:

Hi Delmac,

First: I forgot to declare it Public:

Public Function ByteReverse(InputString As String) As String

Second: Where did you place the function code? It should be in a normal
module?

Stefi

€˛delmac€¯ ezt Ć*rta:

When I tried this I got this message, it couldn't find the UDF how do I get
round this. Thanks again for your help
=SEARCH("0",ByteReverse(D2))
#NAME?

--
delmac


"Stefi" wrote:

=SEARCH("0";ByteReverse(A1))

where cellA1 contains the number to be searched.

The ByteReverse UDF:

Function ByteReverse(InputString As String) As String
Dim i As Long
Dim ByteStr, ResultStr As String
ResultStr = ""
For i = Len(InputString) To 1 Step -1
ByteStr = Mid(InputString, i, 1)
ResultStr = ResultStr & ByteStr
Next i
ByteReverse = ResultStr
End Function

Regards,
Stefi

€˛delmac€¯ ezt Ć*rta:

HI all I have a column of numbers that includes o such as 0045a
078
009. Is there are formula that enables me to find the first 0 from the
right. Thanks for all your help on this and previuos requests.
--
delmac