Opening CSV files and #NAME? error in certain cells
Trevor
thanks for response. My reservation about this approach is that I don't know
where in the sheet the problem data will appear i.e. which cells may be
starting with a hyphen.
So having already opened the sheet, which in some cases may be very large,
as they represent data downloads from a financial system, I don't want to
"go back" and re-open the CSV file under a differnet set of instructions,
but maybe I'll have to do this.
Thanks
Tim
"Trevor Shuttleworth" wrote in message
...
Tim
just guessing that you might get away with formatting the column(s) as
text
before importing the data.
Regards
Trevor
"Tim Childs" wrote in message
...
Hi
Have done a search of Google archives and found the following to help
with
identifying problem:
If Range("A1").Text = "#NAME?" Then ...
'from J Walkenbach
The problem relates to opening CSV files where users have in certain
cells
put in text starting with a hyphen, which generates the #Name? error.
Has anyone some generalised code for replacing these cells (which can be
anywhere on the sheet) - I am sure someone has been through this hoop
before...
Thanks for any tips/help
Tim
Other bits of code, I have started:
Dim rTemp As Range
Set rTemp = Cells.Find(What:="#Name?", After:=ActiveCell,
LookIn:=xlValues, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False)
'now do replacing...something along the lines of (but not using
selection
in
real code, of course):
selection.value=chr(39)&
mid(selection.formula,2,len(selection.formula)-1)
|