Exceldatei umbauen
24.09.2009 16:15:20
Erich
Hi Günter,
probier mal (in ein normales Modul):
Option Explicit
Sub TxtSammCD()
Dim zA As Long, zz As Long
Dim strA As String, strN As String, strC As String, strD As String
zA = 1
For zz = 1 To Cells(Rows.Count, 1).End(xlUp).Row
strN = Cells(zz, 1) & "|" & Cells(zz, 2)
If strN = strA Then
If Cells(zz, 3) "" Then
If strC "" Then strC = strC & ","
strC = strC & "," & Cells(zz, 3)
Cells(zz, 3).ClearContents
End If
If Cells(zz, 4) "" Then
If strD "" Then strD = strD & ","
strD = strD & "," & Cells(zz, 4)
Cells(zz, 4).ClearContents
End If
Else
If strC "" And Cells(zA, 3) strC Then Cells(zA, 3) = strC
If strD "" And Cells(zA, 4) strD Then Cells(zA, 4) = strD
strA = Cells(zz, 1) & "|" & Cells(zz, 2)
zA = zz
strC = Cells(zz, 3)
strD = Cells(zz, 4)
End If
Next zz
End Sub
Rückmeldung wäre nett! - Grüße von Erich aus Kamp-Lintfort