Dear Experts,

I used the code below in cleaning out "leading or trailing" spaces in any workbook (saw the code on one of the excel forums, cant remember which) that i am working on. However lately, i discovered that it just fails for no reason and some days it will work without issues.

Can anybody help spot what could be wrong with this code? or help with another code that works.

       With activesheet.UsedRange

            .Value = Application.Clean(Application.Trim(.Value))

       End With
Note: The above code cleans out my Sheet(s) instantly and i don't have to loop (I have a big data set). That is why i am partial to it and want it to work