AW: Excel Zellen als negativ voreinstellen
24.09.2013 13:25:40
Hajo_Zi
in Auswertung der Beiträge.
Option Explicit
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim RaBereich As Range ' Variable für Bereich
Dim RaZelle As Range ' Variable für Zelle
' Bereich der Wirksamkeit
Set RaBereich = Range("L22:M39, O21:O26")
' noch mehr Bereiche
'Set RaBereich = Union(Range("C11:AG11 , C13:AG13, C15:AG15 , C17:AG17"), _
' Range("C35:AE35, C37:AE37, C43:AG43, C45:AG45 , C47:AG47 , C49:AG49"), _
' Range("C67:AF67 , C69:AF69 , C75:AG75 , C77:AG77 , C79:AG79 , C81:AG81"), _
' Range("C99:AF99 , C101:AF101, C107:AG107 , C109:AG109 , C111:AG111"), _
' Range("C127:AG127 , C129:AG129 , C131:AG131 , C133:AG133 , C139:AF139"), _
' Range("C155:AG155, C157:AG157 , C159:AG159 , C161:AG161 , C163:AG163"), _
' Range("C179:AF179 , C181:AF181, C187:AG187 , C189:AG189 , C191:AG191"))
Set RaBereich = Intersect(RaBereich, Range(Target.Address))
If Not RaBereich Is Nothing Then
'ActiveSheet.Unprotect ("Passwort")
For Each RaZelle In RaBereich
Application.EnableEvents = False
If IsNumeric(RaZelle) Then
If RaZelle > 0 Then
RaZelle = RaZelle * -1
End If
End If
Application.EnableEvents = True
Next RaZelle
'ActiveSheet.protect ("Passwort")
End If
Set RaBereich = Nothing ' Variable leeren
End Sub
Gruß Hajo