View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Code equivalent to the Enter-Key

Private Sub Worksheet_BeforeDoubleClick( _
byVal Target As Range, Cancel As Boolean)
If Target.Cells.Count 1 Then Exit Sub
If Not Intersect(Target, Range("A1:A10")) Is Nothing Then
Target.Font.Name = "Marlett"
If Target = vbNullString Then
Target = "a"
Else
Target = vbNullString
End If
End If
Cancel = True
End Sub


setting cancel to True will solve that problem.

--
regards,
Tom Ogilvy


"JMay" wrote in message
news:eu5sc.4187$zE6.3864@lakeread06...
Thanks Tom;
Actually here is my code:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Target.Cells.Count 1 Then Exit Sub
If Not Intersect(Target, Range("A1:A10")) Is Nothing Then
Target.Font.Name = "Marlett"
If Target = vbNullString Then
Target = "a"
Else
Target = vbNullString
End If
End If
<<<<<<<< SendKeys ("{Enter}") My requested way of

completing
the Macro. See below
End Sub

When I double-click on say A5 the Check mark appears but my cursor is
"sitting, waiting and blinking" one character
to the right, as if the value has not been entered.. That is why I was
asking for the above, so as to complete the assignment
of the value to the cell A5.




"Tom Ogilvy" wrote in message
...
Sendkeys "~"
or
sendkeys "{enter}"

or do you mean

vbCrLf

--
Regards,
Tom Ogilvy


"JMay" wrote in message
news:c45sc.4129$zE6.3489@lakeread06...
Awhile back I had the [VBA]code line for the
keyboard equivalent of pressing the ENTER Key;
Can someone supply,
Maybe this time I can file it better
so that I can access it six months from now..

TIA,