Buenas tardes tengo una macro que me separa archivos .csv en columnas, me los importa y los separa de forma automática, la duda es que con unos archivos me lo realiza sin ningún problema y con otros teóricamente iguales no me hace la separación al ser importados.
Buenas tardes tengo una macro que me separa archivos .csv en columnas, me los importa y los separa de forma automática, la duda es que con unos archivos me lo realiza sin ningún problema y con otros teóricamente iguales no me hace la separación al ser importados.
El código que utilizo, es el siguiente
Sub CARGAR_ESR_CMMS()
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
Range("A1").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\GUILLERMO\PANEL LEAN\TOMA DE DATOS\export EmergencyServiceEvent.csv" _
, Destination:=Range("$A$1"))
.Name = "export EmergencyServiceEvent"
.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 = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End Sub
Con el segundo código no me funciona aunque es un copia pega, aquí pongo lo pongo
Sub CARGAR_TRABAJOS_CMMS()
Range("CH1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
Range("CH1").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\GUILLERMO\PANEL LEAN\TOMA DE DATOS\export Labor.csv", _
Destination:=Range("$CH$1"))
.Name = "export Labor"
.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 = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End Sub
El archivo que no me separa pesa mucho y no se como subirlo, no me importa mandarlo de otra forma, espero vuestros comentarios
Muchas Gracias, De antemano, espero que alguien me pueda ayudar y explicar el motivo
EXPORTAR TRABAJOS.7z