LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,872
Default Name break into half and reverse to upper case

Hi,

Am Mon, 29 Oct 2012 10:47:47 +0000 schrieb shrinivasmj:

EG NAME INOUT AND OUTPUT

Srinivas SRINIVAS
srinivas m M,SRINIVAS

srinivas m.j. J,SRINIVAS M.

srinivas m.j.h. J.H,SRINIVAS M.

srinivas m. j. h. k. H. K,SRINIVAS M. J.

srinivas m. j. h. k. l. H. K. L,SRINIVAS M. J.


try it with VBA (modify to suit):

Sub RevStr()
Dim c As Range
Dim LRow As Long
Dim mySearch As Integer
Dim Start As Integer

LRow = Cells(Rows.Count, 1).End(xlUp).Row
For Each c In Range("A1:A" & LRow)
If InStr(c, ".") = 0 And InStr(Trim(c), " ") 0 Then
mySearch = 2
Else
mySearch = Len(c) - Len(Replace(c, ".", "")) + 1
End If

Select Case mySearch
Case 2
Start = WorksheetFunction.Find(" ", c) + 1
c = Mid(c, Start, 99) & ", " & Left(c, Start - 2)
Case 3, 4
c = WorksheetFunction.Substitute(c, ".", "#", 1)
Start = WorksheetFunction.Find("#", c) + 1
c = Mid(c, Start, 99) & ", " & Left(c, Start - 2) & "."
Case 5, 6, 7, 8, 9, 10
c = WorksheetFunction.Substitute(c, ".", "#", 2)
Start = WorksheetFunction.Find("#", c) + 1
c = Mid(c, Start, 99) & ", " & Left(c, Start - 2) & "."
End Select

c = UCase(Trim(c))

Next
End Sub


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
convert lower to upper case automatically without using UPPER Sal Excel Discussion (Misc queries) 6 July 26th 09 11:27 AM
Changing upper case characters to upper/lower Richard Zignego Excel Discussion (Misc queries) 1 December 17th 07 10:09 PM
Changing file in all upper case to upper and lower case Sagit Excel Discussion (Misc queries) 15 May 30th 07 06:08 AM
Change the text from lower case to upper case in an Excel work boo dave01968 Excel Discussion (Misc queries) 2 December 9th 05 09:09 AM
How do I convert all upper case excel sheet into upper and lower . DebDay Excel Discussion (Misc queries) 1 March 9th 05 08:31 PM


All times are GMT +1. The time now is 05:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"