AW: wie wäre es mit einer Beispieldatei
31.05.2010 11:08:26
jens
Hallo Tino,
Beispiel ist wegen der Daten schlecht.
Hier mal das Gesamtkonstrukt:
Sub TLB_New()
Sheets("Statistik").Select
Reverse = 5
JC_SL = 500
JC_SH = 500
row = 2
col = 8
x = 1
y = 1
Dim Zeile As Long
Zeile = ActiveSheet.UsedRange.Rows.Count
'----------------------------------------------------------------------------------------------- _
Cells(1, 8).Value = JC_SL
Cells(1, 9).Value = JC_SL
Cells(1, 12).Value = JC_SH
Cells(1, 13).Value = JC_SH
'----------------------------------------------------------------------------------------------- _
For i = 1 To Zeile - 2
If Cells(row, 4) Reverse Then c = Cells(row, 8) - Reverse: Call _
Ermittlung1_new(row, c)
If Cells(row, 4) Cells(1, 12) Then Cells(row, 12) = y Else Cells(row, 12) = 0
If Cells(row, 4) > Cells(1, 12) Then Cells(row, 12).Interior.ColorIndex = 36
If Cells(row, 12) = 1 Then Cells(1, 14) = Cells(row, 4)
If Cells(row, 4) > Cells(1, 12) Then y = y + 1
If Cells(row, 12) > Reverse Then d = Cells(row, 12) - Reverse: Call _
Ermittlung2_new(row, d)
If Cells(row, 4) > Cells(1, 12) Then Cells(1, 12).Value = Cells(row, 4)
If Cells(row, 12) = 1 Then x = 1
If Cells(row, 8) = 1 Then y = 1
row = row + 1
Next i
End Sub
Sub Ermittlung1_new(row, c)
iii = 1
Do While row - iii > 0
If Cells(row - iii, 8) = c Then Cells(row - iii, 8).Activate: Cells(1, 11).Value = Cells( _
ActiveCell.row, ActiveCell.Column - 4): Cells(1, 12).Value = Cells(1, 11)
If Cells(row - iii, 8) = c Then iii = row
iii = iii + 1
Loop
End Sub
Sub Ermittlung2_new(row, d)
iv = 1
Do While row - iv > 0
If Cells(row - iv, 12) = d Then Cells(row - iv, 12).Activate: Cells(1, 15).Value = Cells( _
ActiveCell.row, ActiveCell.Column - 8): Cells(1, 8).Value = Cells(1, 15)
If Cells(row - iv, 12) = d Then iv = row
iv = iv + 1
Loop
End Sub
Ich hoffe, das hilft.
Ich denke, wenn man die Selects rausbekommen würde. bringt das schon was.
Wie ist es denn eigentlich mit
Application.ScreenUpdating = False
Application.EnableEvents = False
Application.Calculation = xlManual
und am Ende alles wieder zurück? Bringt das was bzw. geht das?
Gruß Jens