Re: Sortieren nach Zellinhalt
27.09.2002 16:56:40
Chris
Hallo DanielHabe folgendes Makro geschrieben (zugegeben ein rechtes Wirrwar). Der Blattname lautet "Blatt1". zusätzlich musst du noch ein leeres Arbeitsblatt namens "Hilfe" eröffnen, welches du aber ausblenden kannst bzw. das Makro blendet es automatisch aus.
Gruss
Chris
Dim c, d, e, f, g, z
Cells.Select
Selection.Copy
Sheets("Hilfe").Visible = True
Sheets("Hilfe").Select
ActiveSheet.Range("A1").Select
ActiveSheet.Paste
z = 5
For ii = 3 To 7
For i = 6 To 11
Sheets("Hilfe").Select
If ActiveSheet.Cells(i, ii).Formula Like "*" & "x" & "*" Then
c = ActiveSheet.Cells(i, 3).Formula
d = ActiveSheet.Cells(i, 4).Formula
e = ActiveSheet.Cells(i, 5).Formula
f = ActiveSheet.Cells(i, 6).Formula
g = ActiveSheet.Cells(i, 7).Formula
ActiveSheet.Cells(i, 2).Formula = "x"
Sheets("Blatt1").Select
z = z + 1
ActiveSheet.Cells(z, 3).Formula = c
ActiveSheet.Cells(z, 4).Formula = d
ActiveSheet.Cells(z, 5).Formula = e
ActiveSheet.Cells(z, 6).Formula = f
ActiveSheet.Cells(z, 7).Formula = g
End If
Next i
Next ii
For y = 6 To 11
Sheets("Hilfe").Select
If ActiveSheet.Cells(y, 2).Formula <> "x" Then
c = ActiveSheet.Cells(y, 3).Formula
d = ActiveSheet.Cells(y, 4).Formula
e = ActiveSheet.Cells(y, 5).Formula
f = ActiveSheet.Cells(y, 6).Formula
g = ActiveSheet.Cells(y, 7).Formula
Sheets("Blatt1").Select
z = z + 1
ActiveSheet.Cells(z, 3).Formula = c
ActiveSheet.Cells(z, 4).Formula = d
ActiveSheet.Cells(z, 5).Formula = e
ActiveSheet.Cells(z, 6).Formula = f
ActiveSheet.Cells(z, 7).Formula = g
End If
Next y
Sheets("Hilfe").Select
For z = 6 To 11
ActiveSheet.Cells(z, 2).Formula = ""
Next z
Selection.ClearContents
ActiveWindow.SelectedSheets.Visible = False
Sheets("Blatt1").Select
Range("A1").Select