Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Cancel = True not turning edit feature off

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Cancel = True not turning edit feature off

Just got it to work.

I saved and closed the workbook and then reopened it and it started working.



"ToferKing" wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Cancel = True not turning edit feature off

Glad it's working. I would advise against using the IsEmpty version, though.
It doesn't mean what you would think it means (even if it works).
__________________________________________________ ________________________



"ToferKing" wrote in message
...
Just got it to work.

I saved and closed the workbook and then reopened it and it started
working.



"ToferKing" wrote:

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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cancel = True JustBreathe Excel Programming 4 April 9th 07 04:02 AM
why doesnt cancel=true always work? Duncan[_5_] Excel Programming 3 July 18th 06 08:48 AM
How do you cancel the UNDO feature? Rick Setting up and Configuration of Excel 1 December 6th 05 04:24 PM
BeforeDoubleClick Cancel=True not working Reggie Excel Programming 1 September 20th 05 03:43 AM
Setting Cancel = True in WorkbookBeforePrint Tony Excel Programming 0 December 21st 03 10:37 PM


All times are GMT +1. The time now is 06:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"