View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Ross Withey Ross Withey is offline
external usenet poster
 
Posts: 6
Default Instr function problem

Gentlemen,
I have come up with this to reverse a range, so that Instr could then be
used. It is not very elegant, though. Can you think of anything better?
Ross

Sub Reversit()
x = Len(Range("A1")) + 1
For r = 1 To x
Range("A2") = Mid(Range("A1"), r, 1) & Range("A2")
Next
End Sub



"Dan E" wrote in message
...
Ross,

Depending on your version of excel you might have
InStrRev

InStrRev(Range("A1"), "a") will return 6 if A1 is banana

Dan E

"Ross Withey" wrote in message

...
Hello,
If cell A1 has the string value "Bananas"

Instr(1,"Range("A1"), "a") finds the first "a". My problem is, I want to
find the final "a".
Can you suggest the right code? I know I can increase the "1", but I

need to
find the final "a" at the first attempt in a loop. Can you help please?
Thanks,
Ross