UMAKEMESIK
Active Member
- Joined
- Oct 3, 2005
- Messages
- 378
to all,
i have this code that works great.
on this line
Private Sub Worksheet_BeforeRightClick
my two options are rightclick and double click.
I am looking for a third option if there is one available.
is it possible to add a modifier key like the control key
so it would be something like _BeforeControlClick...
if not , then we will be ok with the 2 options.
thanks in advance.
i have this code that works great.
Code:
Private Sub Worksheet_BeforeRightClick(ByVal Target As Excel.Range, Cancel As Boolean)
' This subroutine colors a cell red when double-clicked then clears it when double-clicked again.
' Some values for .ColorIndex are...
' Red = 3, Green = 4, Blue = 5, Yellow = 6, Orange = 45
' Google "VBA color palette" for more colors
' If the cell is clear
If Target.Interior.ColorIndex = xlNone Then
' Then change the background color to red
Target.Interior.ColorIndex = 6
' Else if the cell background color is red
ElseIf Target.Interior.ColorIndex = 6 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
on this line
Private Sub Worksheet_BeforeRightClick
my two options are rightclick and double click.
I am looking for a third option if there is one available.
is it possible to add a modifier key like the control key
so it would be something like _BeforeControlClick...
if not , then we will be ok with the 2 options.
thanks in advance.