Folgendes Problemchen
In den Spalte stehen: cat;titel ;code;notiz
cat1- a- 2- aa
------ x- 2- xx
------ f- 3- ff
cat2- b- -- bb
------ z- 3- zz
------ c- -- cc
cat3- d- -- dd
------ l- -- ll
------ m- -- mm
cat4- p- 4- pp
------ o- 4- oo
------ e- -- ee
cat5- k- -- kk
------ i- -- ii
------ q- -- qq
Diese Werte sollen jetzt so geordnet werden das jeweils in einer cat keine doppelwerte in der mittleren Spalte stehen, getauscht werden darf aber nur mit der jeweiligen nachbar cat(cat1 mit cat2 ; cat3 mit cat2 oder cat4;usw). dabei müssen die nachbar zellen erhalten bleiben,cat muss unverändert bleiben. Was ich da geschrieben habe schaut 1. sch..... aus und funktioniert nur bis auf leere zellen gelaufen wird.
Dim lngRow As Integer
Dim rh
Worksheets("Tabelle1").Select
For lngRow = 1 To 30 Step 3
If Cells(lngRow + 1, 8).Value = Cells(lngRow + 2, 8).Value And Cells(lngRow + 2, 8).Value '> 0 _
Or Cells(lngRow + 1, 8).Value = Cells(lngRow + 3, 8).Value And Cells(lngRow + 3, 8).Value '> 0 _
Or Cells(lngRow + 2, 8).Value = Cells(lngRow + 3, 8).Value And Cells(lngRow + 3, 8).Value '> 0 Then
For rh = 6 To 8
Cells(lngRow + 1, rh + 1).Cut
Cells(lngRow + 5, rh + 1).Insert Shift:=xlDown
Next rh
End If
Next lngRow
End Sub