find caps from right and put { bracket at last caps latter

shrinivasmj

Board Regular
Joined
Aug 29, 2012
Messages
140
hi

need vb or macro

eg input
[TABLE="width: 394"]
<tbody>[TR]
[TD="class: xl65, width: 394"]ABE KERN Gholam Rizaboosaildi Black Creek

out put a2

[TABLE="width: 394"]
<tbody>[TR]
[TD="class: xl65, width: 394"]ABE KERN { Gholam Rizaboosaildi Black Creek


[/TD]
[/TR]
</tbody>[/TABLE]


[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Try:-
Code:
[COLOR="Navy"]Sub[/COLOR] MG14Dec48
[COLOR="Navy"]Dim[/COLOR] str [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]String,[/COLOR] n [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] nStr [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]String[/COLOR]
str = [a1]
[COLOR="Navy"]For[/COLOR] n = Len([a1]) To 1 [COLOR="Navy"]Step[/COLOR] -1
    [COLOR="Navy"]If[/COLOR] Mid(str, n, 1) = " " [COLOR="Navy"]Then[/COLOR]
        [COLOR="Navy"]If[/COLOR] Mid(str, n - 1, 1) = UCase(Mid(str, n - 1, 1)) [COLOR="Navy"]Then[/COLOR]
            nStr = Left(str, n - 1) & " { " & Right(str, Len(str) - n)
            [COLOR="Navy"]Exit[/COLOR] For
        [COLOR="Navy"]End[/COLOR] If
    [COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]Next[/COLOR] n
Range("A2").Value = nStr
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0
need to find from left ,


Sub
MG14Dec48
Dim str As String, n As Long, nStr As String
str = [a1]
For n = Len([a1]) To 1 Step -1
If Mid(str, n, 1) = " " Then
If Mid(str, n - 1, 1) = UCase(Mid(str, n - 1, 1)) Then
nStr = Left(str, n - 1) & " { " & Right(str, Len(str) - n)
Exit For
End If
End If
Next n
Range("A2").Value = nStr
End Sub
 
Upvote 0
2133 JOSEPH DAMON DR ^ Magadan Miass (8)862
624 WOODLAND TRAILS DR ^ Krasnoyarsk Kirsanov 4862
29 WASHINGTON ST. ^ Magadan Cherepovets 8652
19441 134TH AVE. S.E. ^ Tjumen Zavolzhye 84722



 
Upvote 0
hi

need vb or macro

eg input
[TABLE="width: 394"]
<tbody>[TR]
[TD="class: xl65, width: 394"]ABE KERN Gholam Rizaboosaildi Black Creek

out put a2

[TABLE="width: 394"]
<tbody>[TR]
[TD="class: xl65, width: 394"]ABE KERN { Gholam Rizaboosaildi Black Creek


[/TD]
[/TR]
</tbody>[/TABLE]


[/TD]
[/TR]
</tbody>[/TABLE]
Give this macro a try...
Code:
Sub InsertBracketAtEndOfUpperCase()
  Dim R As Long, X As Long, Data As Variant
  Data = Range("A2", Cells(Rows.Count, "A").End(xlUp))
  For R = 1 To UBound(Data)
    For X = 1 To Len(Data(R, 1))
      If Mid(Data(R, 1), X, 1) Like "[a-z]" Then
        Data(R, 1) = Application.Replace(Data(R, 1), X - 1, 0, "{ ")
        Exit For
      End If
    Next
  Next
  Range("A2").Resize(UBound(Data)) = Data
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,162
Messages
6,170,431
Members
452,326
Latest member
johnshaji

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top