Working with cells that generate errors

  • Thread starter Thread starter Revolvr
  • Start date Start date
R

Revolvr

Hi all,

I have an excel workbook where I read in text strings and then do some
manipulation of these strings. Some of the data is freeform text, and
sometimes the text itself causes errors. For example, if I have a cell
with contents something like "=-\tSome Words" (without the quotes).
This string causes a NAME error.

What I want to be able to do, in VBA, is read in the text string to a
value and move it to some other cell. Every time I do this I get an
error 2029, or a "Type Mismatch" error (Err.num=13). I understand I
can put an apostrophe in front of the text. Problem Is I get an error
any time I reference the cell, so I cannot read it in to a string
variable to add the apostrophe.

What is a good way to handle this situation?

TIA!
 
If you use the Formula property of the cell you will get the contents (e.g. "=-\tSome Words") whether or not #NAME? is displayed. You can then add an apostrophe.
 

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

Back
Top