# Error 400. How to fix it. Excel



## PLL-Dave (Mar 14, 2011)

Ok, so i've been using this file to covert data and save is as .csv after i run the macro, i added one column and now the macro won't run. I keep getting error 400. Need help. Code is below. This macro is grabbing info from a excel file named jobimport.csv (in the same folder as the tnt_jobs_import) I already moved the "letters" one over. for example the first one says Range L2 where before it was Range K2. The new column is inserted in F2. I also check that there's no hidden sheets. both the jobimport and tnt_jobs_import have 1 sheet each. The data is save in jobimport.csv from A1 to L1 and down. Thanks for the help. 



Sub Macro1()
'
' Macro1 Macro
' Macro recorded 6/15/2010 by timm
'
' Keyboard Shortcut: Ctrl+i
'METER(Free Text within 10 chars)
Workbooks.Open Filename:="jobimport.csv"
Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Windows("tnt_jobs_import.xlsm").Activate
Range("L2").Select
ActiveSheet.Paste

'PT ID(Number Only within 6 digits)
Windows("jobimport.csv").Activate
Range("B1").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Windows("tnt_jobs_import.xlsm").Activate
Range("M2").Select
ActiveSheet.Paste
Range("A2").Select
ActiveSheet.Paste

'PIN(Number Only within 5 digits)
Windows("jobimport.csv").Activate
Range("C1").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Windows("tnt_jobs_import.xlsm").Activate
Range("N2").Select
ActiveSheet.Paste

'PATIENT FIRST NAME(Free Text within 30 chars)
Windows("jobimport.csv").Activate
Range("D1").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Windows("tnt_jobs_import.xlsm").Activate
Range("O2").Select
ActiveSheet.Paste

'PATIENT LAST NAME(Free Text within 30 chars)
Windows("jobimport.csv").Activate
Range("E1").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Windows("tnt_jobs_import.xlsm").Activate
Range("P2").Select
ActiveSheet.Paste
Range("B2").Select
ActiveSheet.Paste

'PATIENT ADDRESS(Free Text within 30 chars)
Windows("jobimport.csv").Activate
Range("F1").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Windows("tnt_jobs_import.xlsm").Activate
Range("Q2").Select
ActiveSheet.Paste

'CITY(Free Text within 20 chars)
Windows("jobimport.csv").Activate
Range("G1").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Windows("tnt_jobs_import.xlsm").Activate
Range("R2").Select
ActiveSheet.Paste

'ST(Free Text within 2 chars)
Windows("jobimport.csv").Activate
Range("H1").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Windows("tnt_jobs_import.xlsm").Activate
Range("S2").Select
ActiveSheet.Paste

'ZIP(Free Text within 10 chars)
Windows("jobimport.csv").Activate
Range("I1").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Windows("tnt_jobs_import.xlsm").Activate
Range("T2").Select
ActiveSheet.Paste

'PT PHONE(Free Text within 16 chars)
Windows("jobimport.csv").Activate
Range("J1").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Windows("tnt_jobs_import.xlsm").Activate
Range("U2").Select
ActiveSheet.Paste

'PT DR(Free Text within 20 chars)
Windows("jobimport.csv").Activate
Range("K1").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Windows("tnt_jobs_import.xlsm").Activate
Range("V2").Select
ActiveSheet.Paste
'NOTES(Free Text within 50 chars)
Windows("jobimport.csv").Activate
Range("L1").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Windows("tnt_jobs_import.xlsm").Activate
Range("W2").Select
ActiveSheet.Paste
End Sub


----------



## PLL-Dave (Mar 14, 2011)

Just want to also mention that i read thru some post and added these lines in my vba code

On top before the code i added:

On Error GoTo ErrorTrap

and on the bottom before End Sub i added:

ErrorTrap:
MsgBox Err.Description

I re-ran the macro and got this message:

_Select method of Range class failed_


----------

