Supportnet Computer
Planet of Tech

Supportnet / Forum / Tabellenkalkulation

Excel Teilbereiche speichern





Frage

Hallo, habe eine Tabelle mit 10.000 Zeilen. Möchte diese in Paketen zu 500 Zeilen im txt - Format abspeichern. Dies geht manuell, indem ich teile rauskopiere, in eine neue Arbeitsmappe einfüge und dann als txt - Datei abspeichere. Das ganze ist jedoch sehr aufwendig. Kennt jemand eine einfachere Lösung ? Danke für Antwort

Antwort 1 von Beverly

Hi Peter,

Sub textdateien_erstellen()
    Dim Fso
    Dim fsoDatei
    Dim raBereich
    Dim loZeile As Long
    Dim inDatei As Integer
    Dim inZeile As Integer
    inDatei = 1
    inZeile = 1
    For inDatei = 1 To 20
        raBereich = Range("A" & inZeile & ":A" & inZeile + 499)
        Set Fso = CreateObject("Scripting.FileSystemObject")
        Set fsoDatei = Fso.OpenTextFile("C:\Test\Text" & inDatei & ".txt", 8, True)
        For loZeile = 1 To UBound(raBereich)
           fsoDatei.Write raBereich(loZeile, 1) & vbCrLf
        Next
        fsoDatei.Close
        inZeile = inZeile + 500
    Next inDatei
End Sub


Bis später,
Karin

Ich möchte kostenlos eine Frage an die Mitglieder stellen:


Ähnliche Themen:


Suche in allen vorhandenen Beiträgen: