Gruppe
Ereignis
Problem
Wie kann ich eine Reihe von Unterprogrammen in Abhängigkeit vom Namen der Eingabezelle aufrufen?
ClassModule: Tabelle2
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If IsEmpty(Target) Then Exit Sub
If Intersect(Target, Range("B1:B3")) Is Nothing Then Exit Sub
On Error GoTo ERRORHANDLER
Application.EnableEvents = False
Select Case Target.Name.Name
Case "Gewicht": Call Gewicht
Case "Alter": Call Alter
Case "Hautfarbe": Call Hautfarbe
End Select
ERRORHANDLER:
Application.EnableEvents = True
End Sub
StandardModule: basMain
Sub Gewicht()
ActiveCell.Value = 125
End Sub
Sub Alter()
ActiveCell.Value = 54
End Sub
Sub Hautfarbe()
ActiveCell.Value = "Pink"
End Sub