?
Solved

Macro to clean cells and convert text to number

Posted on 2011-10-20
3
Medium Priority
?
213 Views
Last Modified: 2013-11-05
Hi EE,

Please refer to attached file. The content is the result of importing data from another application.
I´ve been trying to convert text to number on column E, via various methods (cell formatting, TRIM, CLEAN formulas, etc ). Nothing has worked. Then I discovered something, that may what´s causing the problem: with cursor on cell E1, if I press F2 and then click on the formula bar, I notice that the cursor blinks 2 or more positions to the right of the text. I conclude that there is garbage there, which is preventing the above mentioned method to work as expected.

So, I think a macro would help to do the job. I kindly ask for your help with the macr, or other effective way to deal with this issue. Book1.xls
0
Comment
Question by:capterdi
3 Comments
 
LVL 24

Accepted Solution

by:
StephenJR earned 2000 total points
ID: 37000931
What about a formula?

=TRIM(SUBSTITUTE(E1,CHAR(160),""))
0
 
LVL 39

Expert Comment

by:nutsch
ID: 37000934
Easiest way to do without a macro, select the last "empty" character in you, copy it with Ctrl+C, do Ctrl+H to do a find replace, paste your character using ctrl+V and replace that by nothing.

You're done.

T
0
 

Author Closing Comment

by:capterdi
ID: 37001002
nutsch:

Thank you for your cooperation. I rather prefer a formula, so I can quickly copy-paste where it´s needed.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question