How can I delete unprintable characters using VBA in Excel?

P

peterv

I want to delete unprintable characters in an Excel sheet using VBA.
I've tried using the CLEAN function, but can't find the correct syntax
to get it to work in VBA. Can anyone help?
Thanks!
 
G

Guest

Use WorksheetFunction.Clean(YourString) - for example, if you wanted to clean
the text in cell A3 you would have:
Range("A3").Value = WorksheetFunction.Clean(Range("A3").Value)
 
T

Tom Ogilvy

for each cell in Activesheet.UsedRange
cell.Value = Application.Clean(cell.Value)
Next


Just note that if you are bringing in your data from a web page (for
example), there may be characters that CLEAN doesn't clean.
 

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.

Ask a Question

Top