Extract To Be Nick Name With Initial in The last Word

muhammad susanto

Well-known Member
Joined
Jan 8, 2013
Messages
2,077
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
hi all...

how to extract this text to be the nick name like this :

nameexpected result
PT. DHARMA BERKAH SERINDITPT. DHARMA BERKAH S
PT. HALMAHERA KAYUPT. HALMAHERA KAYU
KOPERASI PETANI SAWIT MERANGKAI SEJAHTERAKOPERASI PETANI SAWIT MS
PT. INDO PATRIA PERTIWIPT. INDO PATRIA P

<tbody>
</tbody>

any help..much appreciated...

m.sa
 
Last edited:
@footoo
Tried it myself, it simply returns cell A2 as is !!.....no change
If you type the name in yourself, the code works fine. The problem is the spaces in the OP's posted text are not regular spaces (ASCII 32), rather, they are non-breaking spaces (ASCII 160) which are usually acquired by copying from the web. If you change this line of code...

ray = VBA.Split(Name, " ")

to this...

ray = VBA.Split(Replace(Name, Chr(160), " "), " ")

then the code should work fine.
 
Upvote 0

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,215,410
Messages
6,124,749
Members
449,186
Latest member
HBryant

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