View Single Post
 
Old 04-25-2023, 04:23 PM
Dave T Dave T is offline Windows 7 64bit Office 2013
Advanced Beginner
 
Join Date: Nov 2014
Location: Australia
Posts: 66
Dave T is on a distinguished road
Default

Hello p45cal,

Such a frustratingly simple solution that confirms I was overthinking the problem.
I also really appreciate your detailed explanation of what your macro is doing.

I had already worked out that LTrim and RTrim remove spaces from either end of the string, but not reducing any multiple mid spaces to a single space.
I had used SUBSTITUTE in a few of my earlier attempts and it worked, but each time I re-ran the macro on the same cells it kept adding extra spaces either side of the En Dash.
I then found APPLICATION.TRIM, but it seemed wrong to be adding multiple mid spaces in one part of the code and then removing them with another part of the code.

Once again… Thanks for your help and your explanation.
Regards, Dave T
Reply With Quote