Macro der ændre farve på celle
Hej Eksperter!Jeg har en macro der ændre celle farve.
Den virker os fint nok, men vil gerne have den til at os ændre farve til cellen til højre.
lad os sige:
A1 dobbelt klikker jeg på. Så skal B1 os ændre farve.
Koden jeg bruger pt.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Excel.Range, Cancel As Boolean)
If Application.Intersect(Target, Range("D8:AC29")) Is Nothing Then
Exit Sub
End If
' If the cell is clear
If Target.Interior.ColorIndex = xlNone Then
' Then change the background color to red
Target.Interior.ColorIndex = 3
' Else if the cell background color is red
ElseIf Target.Interior.ColorIndex = 3 Then
' Then clear the background
Target.Interior.ColorIndex = xlNone
End If
' This is to prevent the cell from being edited when double-clicked
Cancel = True
End Sub
Jeg takker på forhånd.
