Clever-Excel-Forum

Normale Version: Zahl (Artikelnummer) öfters darstellen
Du siehst gerade eine vereinfachte Darstellung unserer Inhalte. Normale Ansicht mit richtiger Formatierung.
Hallo,

ich habe eine CSV Datei mit Artikelnummer exportiert.

Beispiel:

425254-45
425254-44
425254-43
425254-42
425254-41


Nun möchte ich das jede Artikelnummer insgesamt fünf mal hintereinander dargestellt wird.

Beispielt:

425254-45
425254-45
425254-45
425254-45
425254-45
425254-44
425254-44
425254-44
425254-44
425254-44
usw...
Hallo,

als Makro z.B. so:

Code:
Public Sub Duplizieren()
Dim loLetzte As Long, i As Long

Application.ScreenUpdating = False
With Worksheets("Tabelle1") 'Blattname anpassen
   loLetzte = .Cells(.Rows.Count, 1).End(xlUp).Row
   For i = loLetzte To 1 Step -1
       .Cells(i, 1).Copy
       .Cells(i + 1, 1).Resize(4, 1).Insert
   Next i
   Application.CutCopyMode = False
End With
Application.ScreenUpdating = True
End Sub
Wobei ich angenommen habe, dass die Daten in Spalte A stehen und in A1 beginnen.

Gruß Werner
Code:
Sub M_tst()
   sn = Split(CreateObject("scripting.filesystemobject").opentextfile("G:\OF\Beipiel.csv").readall, vbCrLf)

'   c00 = "425254-45 425254-44 425254-43 425254-42 425254-41"
 '  sn = Split(c00)
   
   For j = 0 To UBound(sn)
       sn(j) = Replace(Space(5), " ", sn(j) & " ")
   Next
   
   MsgBox Replace(Join(sn, ""), " ", vbLf)
End Sub
B1: =INDEX(A:A;ZEILE(A5)/5)
Vielen Dank an alle!

Hat perfekt funktioniert :19: