Re: Instrrev function
- From: DavidC <DavidC@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 22 Apr 2006 15:16:02 -0700
Hi Don,
Tried that and it proves the point. Where I had the difficulty was in
retuning the clomun reference not as an index but as the actual 'name' from
an address. The problem arises when as the column name can be one character
(A-Z) then goes totwo characters (AA-etc). I was using the intersect
function to find a value for a particular date. One of the ranegs then is
the column in which the relevant date is found. The date could be in any
column from A- the end column, and the address for the cell having the date
in it returns as $A$11. I realise the easiest way in this instance would be
simply to remove the last three characters as I am always using the same row,
but I wnated to make the code more flexible. So to get the column reference
for the range value,I had to strip off every other character from the last
'$', leaving only the absolute column reference. I tried using the column
reference address.column, but that returns the index value which range cannot
use in the intersect function.
Thanks though for the comment.
Regards
DavidC
"Don Guillett" wrote:
try this with/wo the +1.
MsgBox Len(ActiveCell) - InStrRev(ActiveCell, "b") + 1
--
Don Guillett
SalesAid Software
dguillett1@xxxxxxxxxxxxx
"DavidC" <DavidC@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:E8F7DEFF-2557-49C3-B82E-8AC63AC03636@xxxxxxxxxxxxxxxx
Hi,
Hope this is noted by Microsoft.
I have been using the Instrrev function in my code and could not figure
out
why I was getting the 'wrong' answer. Well I was reading the description
in
help too literally. The description states
"Returns the position of an occurrence of one string within another, from
the end of string." So my understanding was that it counted the number of
characters back from the end of the string and gave a number equal to the
number of characters back from the end of the string. In fact what the
function seems to do is to search the string from the end of the string,
and
give the number of characters where the particular character occurs from
the
START of the string. This 'error' gave me a few minutes of figuring out.
My suggestion to Microsoft is to make the descriptor a little more obvious
and state that the SEARCH starts from the end and it returns the number of
characters from the START of the string.
Regards
DavidC
- Follow-Ups:
- Re: Instrrev function
- From: Tom Ogilvy
- Re: Instrrev function
- References:
- Re: Instrrev function
- From: Don Guillett
- Re: Instrrev function
- Prev by Date: Re: For Each Next loop Through Userform
- Next by Date: Re: Macro to Delete Row based on <3
- Previous by thread: Re: Instrrev function
- Next by thread: Re: Instrrev function
- Index(es):
Relevant Pages
|