#1   Report Post  
Posted to microsoft.public.excel.misc
nc nc is offline
external usenet poster
 
Posts: 119
Default Text function

Is there a function in Excel 2003 that is like "Search"/"Find", but start
from the right?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,646
Default Text function

Only VBA has such a function (InStrRev). You can create an UDF like this:

Public Function FindRev(StrtoSearch As String, StrSearchedFor As String) As
Long
FindRev = 0
On Error Resume Next
FindRev = InStrRev(StrtoSearch, StrSearchedFor)
End Function

Regards,
Stefi


nc ezt *rta:

Is there a function in Excel 2003 that is like "Search"/"Find", but start
from the right?

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.misc
nc nc is offline
external usenet poster
 
Posts: 119
Default Text function

Dear Stefi

What sbout if I just want to reverse a text in a cell.

Thanks.

NC

"Stefi" wrote:

Only VBA has such a function (InStrRev). You can create an UDF like this:

Public Function FindRev(StrtoSearch As String, StrSearchedFor As String) As
Long
FindRev = 0
On Error Resume Next
FindRev = InStrRev(StrtoSearch, StrSearchedFor)
End Function

Regards,
Stefi


nc ezt *rta:

Is there a function in Excel 2003 that is like "Search"/"Find", but start
from the right?

Thanks

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,646
Default Text function

Sorry, I misread your request! This is the function you want:

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

nc ezt *rta:

Dear Stefi

What sbout if I just want to reverse a text in a cell.

Thanks.

NC

"Stefi" wrote:

Only VBA has such a function (InStrRev). You can create an UDF like this:

Public Function FindRev(StrtoSearch As String, StrSearchedFor As String) As
Long
FindRev = 0
On Error Resume Next
FindRev = InStrRev(StrtoSearch, StrSearchedFor)
End Function

Regards,
Stefi


nc ezt *rta:

Is there a function in Excel 2003 that is like "Search"/"Find", but start
from the right?

Thanks

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Text function

Another one:

Option Explicit
Function ByteReverse2(InputString As String) As String
ByteReverse2 = StrReverse(InputString)
End Function



nc wrote:

Dear Stefi

What sbout if I just want to reverse a text in a cell.

Thanks.

NC

"Stefi" wrote:

Only VBA has such a function (InStrRev). You can create an UDF like this:

Public Function FindRev(StrtoSearch As String, StrSearchedFor As String) As
Long
FindRev = 0
On Error Resume Next
FindRev = InStrRev(StrtoSearch, StrSearchedFor)
End Function

Regards,
Stefi


nc ezt *rta:

Is there a function in Excel 2003 that is like "Search"/"Find", but start
from the right?

Thanks


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.misc
nc nc is offline
external usenet poster
 
Posts: 119
Default Text function

Dear Dave

I tried your solution below and got this error message, "Compile error:
Expected variable or procedure, not module".

Please advise. Thanks.


"Dave Peterson" wrote:

Another one:

Option Explicit
Function ByteReverse2(InputString As String) As String
ByteReverse2 = StrReverse(InputString)
End Function



nc wrote:

Dear Stefi

What sbout if I just want to reverse a text in a cell.

Thanks.

NC

"Stefi" wrote:

Only VBA has such a function (InStrRev). You can create an UDF like this:

Public Function FindRev(StrtoSearch As String, StrSearchedFor As String) As
Long
FindRev = 0
On Error Resume Next
FindRev = InStrRev(StrtoSearch, StrSearchedFor)
End Function

Regards,
Stefi


âžnc❠ezt Ã*rta:

Is there a function in Excel 2003 that is like "Search"/"Find", but start
from the right?

Thanks


--

Dave Peterson

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,646
Default Text function

It's annoying to realize that there is a much simpler solution than the one
you used up to now! It's also annoying that XL doesn't includes such useful
functions as built-in functions!

Stefi


Dave Peterson ezt *rta:

Another one:

Option Explicit
Function ByteReverse2(InputString As String) As String
ByteReverse2 = StrReverse(InputString)
End Function



nc wrote:

Dear Stefi

What sbout if I just want to reverse a text in a cell.

Thanks.

NC

"Stefi" wrote:

Only VBA has such a function (InStrRev). You can create an UDF like this:

Public Function FindRev(StrtoSearch As String, StrSearchedFor As String) As
Long
FindRev = 0
On Error Resume Next
FindRev = InStrRev(StrtoSearch, StrSearchedFor)
End Function

Regards,
Stefi


âžnc❠ezt Ã*rta:

Is there a function in Excel 2003 that is like "Search"/"Find", but start
from the right?

Thanks


--

Dave Peterson

  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Text function

What did you name your module?

Don't use the same name for functions/subs as the name of a module.

Try going into the VBE
hit ctrl-r (to see the project explorer)
select your project
Show all the modules
If you have one named ByteReverse (or ByteReverse2), rename it to:
Mod_ByteReverse
(or anything that is unique).

By the way, if I recall correctly, strreverse was added in xl2k. If you're
using xl97, you'll want to use Stefi's code.

(I'm sure someone will correct me if my memory is failing me on StrReverse.)

nc wrote:

Dear Dave

I tried your solution below and got this error message, "Compile error:
Expected variable or procedure, not module".

Please advise. Thanks.

"Dave Peterson" wrote:

Another one:

Option Explicit
Function ByteReverse2(InputString As String) As String
ByteReverse2 = StrReverse(InputString)
End Function



nc wrote:

Dear Stefi

What sbout if I just want to reverse a text in a cell.

Thanks.

NC

"Stefi" wrote:

Only VBA has such a function (InStrRev). You can create an UDF like this:

Public Function FindRev(StrtoSearch As String, StrSearchedFor As String) As
Long
FindRev = 0
On Error Resume Next
FindRev = InStrRev(StrtoSearch, StrSearchedFor)
End Function

Regards,
Stefi


âžnc❠ezt Ã*rta:

Is there a function in Excel 2003 that is like "Search"/"Find", but start
from the right?

Thanks


--

Dave Peterson


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bug with Text function? headly Excel Worksheet Functions 3 March 2nd 06 10:15 PM
Using Concatenate function to generate text in Text Box Mary S. Charts and Charting in Excel 1 December 14th 05 08:55 PM
If Then Function with text Karen Excel Discussion (Misc queries) 4 December 12th 05 11:41 PM
Text Function Chris Huisken Excel Worksheet Functions 2 April 19th 05 10:24 PM
Macro or Function to make text size to suite text Length? lbbss Excel Discussion (Misc queries) 4 December 14th 04 07:53 PM


All times are GMT +1. The time now is 01:29 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright 2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"