Saltar al contenido
View in the app

A better way to browse. Learn more.

Ayuda Excel

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

TXT a Excel

publicado

Hola amigos, como estan

espero que todo bien.

Tengo una situación.

lo que pretendo hacer, esque desde un archivo txt me convierta a excel y que me ponga la información en cada columna. y al final de cada importe me ponga un total

adjunto como esta mi información en txt y como debe de quedar en excel

de antemano , muchas gracias.

TXT.txt

TXT.rar

Featured Replies

publicado
Sub TXTaEXCEL()
With ActiveSheet.QueryTables.Add(Connection:="TEXT;" & _
    "D:\Documents and Settings\pc\Mis documentos\Downloads\TXT.txt", _
     Destination:=Range("$A$2"))
    .TextFileOtherDelimiter = "|"
    .TextFileDecimalSeparator = "."
    .TextFileThousandsSeparator = ","
    .Refresh BackgroundQuery:=False
End With
End Sub

 

publicado

Hola Diego mira sin necesidad de programación hice esta macro

	Sub Macro1()
'
' Macro1 Macro
'
	'
    With ActiveSheet.QueryTables.Add(Connection:= _
        "TEXT;C:\Users\leandro\Downloads\TXT.txt", Destination:=Range("$A$1"))
        .CommandType = 0
        .Name = "TXT"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .TextFilePromptOnRefresh = False
        .TextFilePlatform = 850
        .TextFileStartRow = 1
        .TextFileParseType = xlDelimited
        .TextFileTextQualifier = xlTextQualifierDoubleQuote
        .TextFileConsecutiveDelimiter = False
        .TextFileTabDelimiter = True
        .TextFileSemicolonDelimiter = False
        .TextFileCommaDelimiter = False
        .TextFileSpaceDelimiter = False
        .TextFileOtherDelimiter = "|"
        .TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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
	

publicado

Yo hice lo mismo que Leandro, pero le quite el exceso de código.

Por cierto Leandro, creo que es necesario parametrizar lo siguiente:

    .TextFileDecimalSeparator = "."
    .TextFileThousandsSeparator = ","

Diego, no es necesario una macro para resolver tu problema.

Datos\Importar desde txt y luego seguir las distintas pantallas. 

publicado
  • Autor

Amigos les agradesco mucho por la ayuda y presisamente ayer en la noche estuve buscando en algunas paginas pero sinceramente me di por vencido, y despues me puse a checar este código y yo en lo particular me funcionó. amigo @Macro Antonio con ( Datos\Importar desde txt y luego seguir las distintas pantallas.  ) tambien lo hice, pero mi idea era de que se haga en automático.

@LeandroA de igual manera agradesco por tu apoyo.

 

Maestro @Macro Antonio me gustaría saber su punto de vista con éste código no se si estoy en lo correcto o estoy mal :)

Sub leertx_()
On Error Resume Next
Dim Archivo As String
Archivo = Application.GetOpenFilename(FileFilter:="(Archivo de Texto (*.txt), *.txt)", Title:="Elija txt")
Workbooks.OpenText Archivo
On Error GoTo 0
End Sub

 

publicado

Nunca he usado .OpenText, por otro lado tampoco se lo que pretendes hacer con esta macro. 

  • Silvia bloqueó este tema

Archivado

Este tema está ahora archivado y está cerrado a más respuestas.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.