Gruppe
Feature
Problem
Wie kann ich in XL8 verhindern, daß in einer Zelle in Spalte A eine "1" eingetragen wird, wenn diese in der danebenliegenden Zelle von Spalte B schon vorhanden ist? Dies soll auch wechselweise gelten.
ClassModule: Tabelle3
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim intRow As Integer
Application.EnableEvents = False
On Error GoTo ERRORHANDLER
If Target.Column = 2 Then
With Worksheets(Target.Offset(0, -1).Value)
intRow = .Cells(Rows.Count, 3).End(xlUp).Row + 1
.Cells(intRow, 4) = Target
.Cells(intRow, 3) = Target.Parent.Name
End With
ElseIf Target.Column = 4 Then
With Worksheets(Target.Offset(0, -1))
intRow = .Cells(Rows.Count, 1).End(xlUp).Row + 1
.Cells(intRow, 2) = Target
.Cells(intRow, 1) = Target.Parent.Name
End With
End If
ERRORHANDLER:
Application.EnableEvents = True
End Sub
ClassModule: Tabelle1
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim iRow As Integer
Application.EnableEvents = False
On Error GoTo ERRORHANDLER
If Target.Column = 2 Then
With Worksheets(Target.Offset(0, -1).Value)
iRow = .Cells(Rows.Count, 3).End(xlUp).Row + 1
.Cells(iRow, 4) = Target
.Cells(iRow, 3) = Target.Parent.Name
End With
ElseIf Target.Column = 4 Then
With Worksheets(Target.Offset(0, -1).Value)
iRow = .Cells(Rows.Count, 1).End(xlUp).Row + 1
.Cells(iRow, 2) = Target
.Cells(iRow, 1) = Target.Parent.Name
End With
End If
ERRORHANDLER:
Application.EnableEvents = True
End Sub