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

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Forum statistics

Threads
1,214,819
Messages
6,121,737
Members
449,050
Latest member
excelknuckles

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