Private
Sub
cmd_Simultanität_aus_Click().
ActiveSheet.Unprotect Password:=
""
Dim
rngAuswahl
As
Range
Dim
c
As
Object
On
Error
GoTo
LeaveSub
Set
rngAuswahl = Application.InputBox(
"Bitte die Zelle markieren, dessen Simultanität geändert werden soll."
, Type:=8)
If
rngAuswahl.Rows.Count > 1
Then
MsgBox
"Bitte wählen Sie nur ein Equipment / eine Anlage aus."
, vbCritical
Exit
Sub
End
If
For
Each
c
In
rngAuswahl.Cells
If
IsNumeric(c.Value)
And
Not
IsEmpty(c.Value)
Then
If
Cells(c.Row, 7).Value <>
"x"
Then
MsgBox
"Bitte wählen Sie erst die gesamte Zeile simultan."
, vbCritical
Exit
Sub
End
If
If
c.Font.ColorIndex <> 16
Then
ActiveSheet.Unprotect Password:=
""
c.Font.ColorIndex = 16
Range(
"A6"
).Value =
"Gebäude"
GoTo
1
End
If
If
c.Font.ColorIndex = 16
Then
ActiveSheet.Unprotect Password:=
""
c.Font.ColorIndex = xlAutomatic
Range(
"A6"
).Value =
"Gebäude"
End
If
End
If
1:
Next
c
End
Sub