AW: Balkendiagramm mit Löschfunktion
06.01.2004 18:53:01
Klaus-Dieter
Hallo Jürgen,
auch das geht:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim start As Integer
Dim start1 As Integer
Dim ziel As Integer
Dim anz As Integer
If Target.Column = 5 Or Target.Column = 6 Or Target.Column = 7 Then
If Cells(Target.Row, 5) = "" And Cells(Target.Row, 6) = "" And Cells(Target.Row, 7) = "" Then
Range("H" & Target.Row, "IV" & Target.Row).Interior.ColorIndex = xlNone
End If
If Cells(Target.Row, 5) <> "" And Cells(Target.Row, 6) <> "" And Cells(Target.Row, 7) <> "" Then
Range("H" & Target.Row, "IV" & Target.Row).Interior.ColorIndex = xlNone
start1 = 8
start = Format(Cells(Target.Row, 6), "hh")
ziel = Format(Cells(Target.Row, 7), "hh")
Do While Cells(1, start1) <> Cells(Target.Row, 5)
start1 = start1 + 1
Loop
If start > ziel Then
anz = (24 - start) + ziel
Else: anz = ziel - start
End If
start = start + start1
anz = anz + start + 1
Do While start < anz
Cells(Target.Row, start).Interior.ColorIndex = 1
start = start + 1
Loop
End If
End If
End Sub
Code eingefügt mit: Excel Code Jeanie
Wenn du jetzt noch die Werte automatisch eigetragen haben willst, dann streike ich ;-))
Gruß Klaus-Dieter