wie kann ich diese beiden Change Events ( bei Änderung in Spalte K und Änderung in Spalte I), verknüpfen ? (ja, wahrscheinlich mit einer If abfrage, aber ich komme nicht ganz klar wie ich das hierbei handlen soll:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim res As Long
Dim rngz As Range
Dim rang As Range
Dim rangz As Range
On Error GoTo Ende
Application.EnableEvents = False
For Each rngz In Application.Intersect(Columns("K"), Target).Cells
If rngz 0 Then
res = MsgBox("You are about to set the index at: " & rngz & " .Please note, that once the _
index is set, it can only be changed by pressing the 'New Index / New Change No.'-Button on the _
top left of the spreadsheet. If you want to set the index at: " & rngz & " please press 'yes'", vbInformation + vbYesNo, "Setting index")
Select Case res
Case vbYes
Case vbNo
rngz.Clear
End Select
End If
Next rngz
For Each rang In Application.Intersect(Columns("I"), Target).Cells
If rang 0 Then
res = MsgBox("You are about to set the index at: " & rang & " .Please note, that once the _
index is set, it can only be changed by pressing the 'New Index / New Change No.'-Button on the _
top left of the spreadsheet. If you want to set the index at: " & rang & " please press 'yes'", vbInformation + vbYesNo, "Setting index")
Select Case res
Case vbYes
Case vbNo
rang.Clear
End Select
End If
Next rang
Ende:
Application.EnableEvents = True
End Sub
LG Nati