By winging your way on over to Dave McRitchies excellent addin called TrimAll. Just like Ronseal,
it does what it says on the tin (The Brits will understand anyway). Available free from:-
First select the area to be trimmed, then run this code:
Application.Screenupdating = False
For Each cel In Selection
cel.Value = Application.WorksheetFunction.Trim(cel.Value)
Next
Application.Screenupdating = True
If you know you need a macro in the future the programming
group would be the correct group. If you don't know if you need
a programming solution or a worksheet solution or doesn't fit
you can post the misc group for general type questions.
Since there is no built-in solution for Excel to process the entire
sheet you would need a macro.
Thank you very much for your response, David. Your TrimAll code does
indeed work SIGNIFICANTLY faster than the one I suggested (and which I
have been using). The other issues it addresses are important to note
as well. Consequently, I've replaced my code with yours in my
Personal.xls.
Many thanks for this and other very useful code you've shared with the
group.
Paul
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.