Thread: reverse text
View Single Post
  #3   Report Post  
Richard Buttrey
 
Posts: n/a
Default

Ooops, sorry. That first line after the Dim Statements should have
been

Set rStart = Range("a1")


On Fri, 30 Sep 2005 16:25:45 +0100, Richard Buttrey
wrote:

On Fri, 30 Sep 2005 08:14:21 -0500, tom mcdonald
wrote:


column (a)
00092a
01298a
0000000567a
0123
01a
I need to use a function or procedure to find the last o in each cell
in column(a)
Can anyone please help thanks.



I'm interpreting your request as wanting to find the position of the
last 0 in the cell.

Assuming your data starts in A1 and you want the zero positions in B1

The following is one procedure.

Sub FindLastZero()
Dim MyString As String
Dim iZeroPos As Integer, icount As Integer
Dim rStart As Range

Set rStart = Range("a12")
Do While rStart.Offset(icount, 0) < ""
MyString = StrReverse(rStart.Offset(icount, 0))
If InStr(1, MyString, "0") < 0 Then
iZeroPos = WorksheetFunction.Find("0", MyString)
iZeroPos = Len(MyString) - iZeroPos + 1
rStart.Offset(icount, 1) = iZeroPos
End If
icount = icount + 1
Loop
End Sub

HTH

__
Richard Buttrey
Grappenhall, Cheshire, UK
__________________________


__
Richard Buttrey
Grappenhall, Cheshire, UK
__________________________