05.01.2022, 17:45
Hallo Zusammen,
ist es möglich in einer Tabelle zwei
Sub Worksheet_Change(ByVal Target As Range) zu benutzen? ich bekomme einen Fehler, hier meine codes
code 1
und her code 2
danke für die Hilfe
t
ist es möglich in einer Tabelle zwei
Sub Worksheet_Change(ByVal Target As Range) zu benutzen? ich bekomme einen Fehler, hier meine codes
code 1
Code:
Sub Worksheet_Change(ByVal Target As Range)
Dim cRange As Range
Dim sRange As Range
Set cRange = Range("C5:C100")
Set sRange = Range("I5:I100")
If Not Intersect(Target, ActiveCell) Is Nothing Then
Select Case Range("H5")
Case "January": Range("G5") = WorksheetFunction.SumIf(cRange, "January", sRange)
Case "February": Range("G5") = WorksheetFunction.SumIf(cRange, "February", sRange)
Case "March": Range("G5") = WorksheetFunction.SumIf(cRange, "March", sRange)
Case "April": Range("G5") = WorksheetFunction.SumIf(cRange, "April", sRange)
Case "May": Range("G5") = WorksheetFunction.SumIf(cRange, "May", sRange)
Case "June": Range("G5") = WorksheetFunction.SumIf(cRange, "June", sRange)
Case "July": Range("G5") = WorksheetFunction.SumIf(cRange, "July", sRange)
Case "August": Range("G5") = WorksheetFunction.SumIf(cRange, "August", sRange)
Case "September": Range("G5") = WorksheetFunction.SumIf(cRange, "September", sRange)
Case "October": Range("G5") = WorksheetFunction.SumIf(cRange, "October", sRange)
Case "November": Range("G5") = WorksheetFunction.SumIf(cRange, "November", sRange)
Case "December": Range("G5") = WorksheetFunction.SumIf(cRange, "December", sRange)
End Select
End If
End Sub
und her code 2
Code:
Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, ActiveCell) Is Nothing Then
Select Case ActiveCell
Case "Updated balance sheet, Closed": Status1
Case "Missing approval for balance sheet": Status2
Case "Return, on Hold, Refund": Status3
Case "": Status10
End Select
End If
End Sub
danke für die Hilfe
t