Find First Lower Case Letter

Posted on Thursday 15 December 2005

Following a question in JMT I wrote this UDF, it finds the first lower case letter in a cell

Public Function FindLower(cell As Object)
'''Finds the first lower case letter in a cell
If cell.Cells.Count  1 Then
FindLower = "Error - enter only one cell"
Exit Function
End If
For i = 1 To Len(cell.Text)
If Asc(Mid(cell.Text, i, 1))> 90 Then '90 = "Z"
FindLower = i
Exit Function
End If
Next
FindLower = "No Find Mister"
End Function

To use this in a speadsheet, copy the above code, goto Excel and press Alt+F11 (press them together). The visual basic editor will open. Goto the insert menu and click on "moduel". This will create a new moduel, paste the code into this and close the VB editor down.
Back in excel call the function with
=Findlower(a1)


No comments have been added to this post yet.

Leave a comment

(required)

(required)


.

Use [VBA] Your Code [/VBA], when posting code, cheers Ross x /


RSS feed for comments on this post | TrackBack URI