AW: Name von 2 Makros sind identisch...FEHLER
29.06.2004 18:49:55
2
Erst mal vielen Dank für Eure Hilfe,
leider bin ich Anfänger und komme trotz Euren Lösungsvorschlägen nicht weiter. Die Datei ist ein Tippschein für ein Bundesliga-Tipp.
Der erste Code sorgt dafür, dass in einer bestimmten Spalte alle 9 Felder nur ein X gemacht werden kann, der zweite code lässt pro Spieltag nur fünfmal ein gleiches Ergebnis zu. ich habe beide Codes mal unten eingefügt.
Wie könnte man jetzt den zweiten denn umbenennen?
tobias
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Column <> 8 Then Exit Sub
a = Int((Target.Row - 0.5) / 9) * 9 + 1
e = a + 8
If Application.WorksheetFunction.CountIf(Range(Cells(a, 8), Cells(e, 8)), "x") > 1 Then
Target.ClearContents
End If
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 5 Or Target.Column = 7 Then
zeile = Target.Row
von = zeile - (zeile - 1) Mod 9
bis = zeile + 8 - (zeile - 1) Mod 9
anzahl = 0
If Target.Value <> "" Then
For z = von To bis
If z <> zeile Then
If Cells(z, 5) = Cells(zeile, 5) And Cells(z, 7) = Cells(zeile, 7) Then anzahl = anzahl + 1
If anzahl >= 5 Then
Target.Value = ""
Range(Target.Address).Select
MsgBox ("Eingabe nicht möglich! Das Ergebnis kommt an diesem Spieltag bereits fünfmal vor!!")
Exit Sub
End If
End If
Next
End If
End If
End Sub