Ok so I'm completely new to excel (and coding in general) and I just can't get it to work.
I managed to get this far, but it telly me an End If is missing. (And I'm sure a lot more is missing as well):
The function is supposed to be:
I managed to get this far, but it telly me an End If is missing. (And I'm sure a lot more is missing as well):
VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("D5:Q68")) Is Nothing Then
If Target.Cells.Count > 1 Then Exit Sub
Cancel = True
If Target.Value <> "Nur Leitungsteam" Then
Target.Value = True
Else
If Target.Value <> "" Then Target.Value = "x"
End If
If Target.Interior.ColorIndex = xlNone Then Target.Interior.ColorIndex = 4
Else
If Target.Interior.ColorIndex = 4 Then Target.Interior.ColorIndex = xlNone
End If
End If
End Sub
The function is supposed to be:
- If a cell is blank and without text and you doubleclick it, it changes to green with an X in it
- If a cell is blank with the text "Nur Leitungsteam" in it and you doubleclick it, it changes to green but the text stays
- If a cell is green with an X and you doubleclick it again, it changes back to blank with no text
- If a cell is green with the text "Nur Leitungsteam" and you doubleklick it again, it changes back to blank but the text stays