T
ToferKing
I have been goofing around with both of these codes, thanks to the help of
you guys here and in my research I see that the Cancel = True line is in the
coding to tell Excel not to go into edit mode when a cell is double-clicked.
Well, when I double-click in the target range of cells B3 to B8, Excel is
going into Edit mode.
What am I doing wrong?
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True
If Not Intersect(Target, Range("B3:B8")) Is Nothing Then
If Target = "P" Then
Target = vbNullString
ElseIf Target = vbNullString Then
Target = "P"
Else
End If
End If
End Sub
OR
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True
With Target
If Not Intersect(.Cells, Range("B3:B8")) Is Nothing Then
If IsEmpty(.Value) Then
.Value = "P"
Else
.ClearContents
End If
End If
End With
End Sub
you guys here and in my research I see that the Cancel = True line is in the
coding to tell Excel not to go into edit mode when a cell is double-clicked.
Well, when I double-click in the target range of cells B3 to B8, Excel is
going into Edit mode.
What am I doing wrong?
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True
If Not Intersect(Target, Range("B3:B8")) Is Nothing Then
If Target = "P" Then
Target = vbNullString
ElseIf Target = vbNullString Then
Target = "P"
Else
End If
End If
End Sub
OR
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True
With Target
If Not Intersect(.Cells, Range("B3:B8")) Is Nothing Then
If IsEmpty(.Value) Then
.Value = "P"
Else
.ClearContents
End If
End If
End With
End Sub