ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Working with cells that generate errors (https://www.excelbanter.com/excel-programming/416199-working-cells-generate-errors.html)

Revolvr

Working with cells that generate errors
 
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!

Ardus Petus

Working with cells that generate errors
 
activecell.Value = "'" & activecell.Formula

HTH
--
AP

"Revolvr" a écrit dans le message de news:
...
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!





All times are GMT +1. The time now is 05:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com