Hello All,
My VBA is pretty weak, what I have is a conglomarate of on double click examples I found online that I have attempted to edit for my data set, and the addition of some code coppied from record macros to get formating values. Honestly, I am not sure if I am one letter off or 5 miles from the finish.
I am trying to create a macro for on double click, withing range "Query1__2[NAME]", that will format a cells collor if no color formating is present, and remove any color formating if a formatting color is present. What I have so far is bellow.
Currently my complie error isocouring on the 2nd ElseIf statement, error is "Else without If"
Any Help will be greatly appreciated, thanks everyone.
My VBA is pretty weak, what I have is a conglomarate of on double click examples I found online that I have attempted to edit for my data set, and the addition of some code coppied from record macros to get formating values. Honestly, I am not sure if I am one letter off or 5 miles from the finish.
I am trying to create a macro for on double click, withing range "Query1__2[NAME]", that will format a cells collor if no color formating is present, and remove any color formating if a formatting color is present. What I have so far is bellow.
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Application.Intersect(Target, Range("Query1__2[NAME]")) Is Nothing Then
Cancel = True
ElseIf Selection.Interior.Pattern = xlNone Then
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent6
.TintAndShade = 0.399975585192419
.PatternTintAndShade = 0
ElseIf Selection.Interior.Pattern <> xlNone Then
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
Else: Cancel = True
End If
End Sub
Currently my complie error isocouring on the 2nd ElseIf statement, error is "Else without If"
Any Help will be greatly appreciated, thanks everyone.
Last edited by a moderator: