Create shortcut to enter non-breaking spaces

crg42

New Member
Joined
Mar 10, 2024
Messages
1
Office Version
  1. 2021
Platform
  1. Windows
I live in Jersey. Many names have French origins. To enter [such as] Le Claire, I have to enter Le/alt0160/Claire to ensure the name appears alphabetically under L and not C. De la Mare requires two alt0160 entries. Control+shift+space does not work.

I want to create my own shortcut to enter non-breaking spaces.

Any ideas?
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
A macro won't work because a macro can't run while the cell is open for editing. A macro to replace all space in a cell with non-breaking spaces might work, after you have typed in the name. Is there anything in the cell besides the last name?

EDIT:
VBA Code:
    Selection.Replace What:=" ", Replacement:=Chr(160), LookAt:=xlPart

I am not following how the space affects your alphabetization. Excel should sort based on the ASCII code collating sequence regardless of whether the space in the middle is a normal space or a non-breaking space. The following example uses normal spaces.

ensure the name appears alphabetically under L and not C

Before sorting:

$scratch.xlsm
A
1Le Claire
2De la Mare
3Clooney
4Clabber
5Lamont
6Loman
7Macy
8Moony
9Davison
10Dohan
Sorting


After sorting:

$scratch.xlsm
A
1Clabber
2Clooney
3Davison
4De la Mare
5Dohan
6Lamont
7Le Claire
8Loman
9Macy
10Moony
Sorting
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,891
Messages
6,175,229
Members
452,621
Latest member
Laura_PinksBTHFT

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