Myrna said:
Your post reminds me of something that I discovered this weekend that I find
curious.
[snipped]
Another item: if a CSV file contains this text =10-3 and you import the file,
Excel carries out the arithmetic and the cell value is 7, not the
text =10-3
Myrna,
I've also stumbled across something similar to that last point before.
I have some macros which handle Print (.prn) files. Essentially they
import a file and parse it with the fixed length option. The macro then
strips out all the non essential stuff like banner headlines,
superfluous total rows and other textual stuff so that I end up with a
nice neat database which I can then procede to handle with Excel's
tools and formulae.
One of the problems I've encountered is where for instance a row
contains say a Supplier Name with a hyphen '-' within it, and the
parsing just happens to break the name before the hyphen. e.g a name
like "AB Smith - Trading as XYZ" breaks into two columns "AB Smith "
and "-trading as XYZ".
Part of my macro examines all the cells in the second column, which for
the bulk of the report are number values, and tests that they are
values. However when it encounters the example above, it thinks the
cell is a number, because it starts with a minus '-' and VBA falls over
since it can't handle it. I've had to devise some more complicated code
which references other columns of the .prn file in order to get round
this.
What I'd really like is a neater elegant solution in VBA that could
handle this condition.
Any ideas / comments - anyone??
Kind regards and usual TIA
Richard Buttrey