Hi praveen,

Let's say you have "United States of America" in "A1" cell and "
" (space) in "A2" cell.
Now you can run this code and get result in "A3" cell.
Enjoy!


Sub test1()
Dim currentCell, currentLength, currentSymbol, i, currentSpace, j

    j = 1
    Range("A2").Select
    currentSpace = ActiveCell.Value
    Range("A1").Select
    currentCell = ActiveCell.Value
    currentLength = Len(currentCell)
    currentSymbol = Mid(currentCell, currentLength, 1)
    If currentSymbol = currentSpace Then
    j = 1
    GoTo TheEnd
    End If
Again:
    currentSymbol = Mid(currentCell, currentLength, 1)
    If currentSymbol <> currentSpace Then
    j = j + 1
    currentLength = currentLength - 1
    GoTo Again
    End If
TheEnd:
    Range("A3").Select
    ActiveCell.Value = j
MsgBox ("done!")

End Sub



On Jul 2, 5:18 pm, praveen kumar <bhspra...@gmail.com> wrote:
> Hi Friends,
>
> Is there any way to find the position of the space in a word from right side.
>
> Ex: United States of America - here the position of the space from
> right side is 8.
>
> --
>
> Regards,
> praveen

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 7000 subscribers worldwide and receive many nice notes about the 
learning and support from the group.Let friends and co-workers know they can 
subscribe to group at http://groups.google.com/group/excel-macros/subscribe

Reply via email to