Importing Data Error #NAME?

purceld2

Well-known Member
Joined
Aug 18, 2005
Messages
586
Office Version
  1. 2013
Platform
  1. Windows
Hi

I have imported a CSV into spreadsheet and get a funny error in on of the coulums

It appears the Excel does not like the data being import into this colum

Data

- Help Them Please.mp3

Excel changes the cell

=- Help Them Please.mp3

And the Cell displays #NAME?

Any ideas why this is?

Thanks in advance for your help

Desmond
 
Hmmm...

It seems to work just fine for me. Can you do the following?
1. Turn on the Macro Recorder
2. Record yourself opening the file with the Import Wizard, like I instructed
3. Stop the Macro Recorder
4. Copy and paste the VBA code it recorded here
5. Let me know what column these values are showing up in

That will show he exactly what you are doing, and I can check to see if all the settings look correct
(note that when you get to Step 3, it will be on the FIRST field, by default; you need to select the field that has this value, and then change THAT field to text).
 
Upvote 0

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Hi Joe4,

As requested I have recorded my actions see below

Code:
Sub DateInput()
'
' DateInput Macro
'


'
    With ActiveSheet.QueryTables.Add(Connection:= _
        "TEXT;I:\BT Sync Folder\BT Cloud\New Music Library\New Music Library Tags.csv" _
        , Destination:=Range("$A$1"))
        .CommandType = 0
        .Name = "New Music Library Tags"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .TextFilePromptOnRefresh = False
        .TextFilePlatform = 1252
        .TextFileStartRow = 1
        .TextFileParseType = xlDelimited
        .TextFileTextQualifier = xlTextQualifierDoubleQuote
        .TextFileConsecutiveDelimiter = False
        .TextFileTabDelimiter = False
        .TextFileSemicolonDelimiter = True
        .TextFileCommaDelimiter = False
        .TextFileSpaceDelimiter = False
        .TextFileColumnDataTypes = Array(2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
        .TextFileTrailingMinusNumbers = True
        .Refresh BackgroundQuery:=False
    End With
    ActiveWindow.ScrollColumn = 4
    ActiveWindow.ScrollColumn = 5
    ActiveWindow.ScrollColumn = 6
    ActiveWindow.ScrollColumn = 7
    ActiveWindow.ScrollColumn = 8
    ActiveWindow.ScrollColumn = 7
    ActiveWindow.ScrollColumn = 6
    ActiveWindow.ScrollColumn = 5
    ActiveWindow.ScrollColumn = 4
    ActiveWindow.ScrollColumn = 3
    ActiveWindow.ScrollColumn = 2
    ActiveWindow.ScrollColumn = 1
End Sub

T68gUR.jpg
 
Upvote 0
You missed my last question.
Which field (column) contains this value that is causing problems?
I need to know that in order to verify your code.
 
Upvote 0
Hi Joe4,

The fields that are throwing up the errors are J2-J10 in image in previous post.

see image below
gFm1j5.jpg
 
Upvote 0
You aren't selecting the field. You are updating the first one, as can be seen here in this line:
Code:
        .TextFileColumnDataTypes = Array(2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
The values in the arrays represents the selections that you made for each columns (first is column A, second is column B, etc).
Since "J" is the tenth column, the tenth number in that array is what you want to look at. It is set to 1 (the first option in the Data Type list - General).
As you can see, the first one (column "A") is set to 2 (which is Text). So you are changing the Data Type for column A, not column J.

In looking at the screen print you posted, you scroll over to column J, but never selected it. Click on the title "General" above that column. The whole column should then be darkened/highlighted. That is how you select that column. Then change the data type to "Text".

If done right, the line of VBA code above would look like:
Code:
        .TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1)
 
Upvote 0
Hi Joe4,

You are absolutely correct I was not selecting the field. Working Fine now.

Thank you for sticking this out with me, I really appreciated it.

Thanks again

Desmond
 
Upvote 0
You are welcome!
Glad we got it all sorted out.
:cool:
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,305
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top