Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 536
Default Get rid of need for F2.Select

The code I wrote here works fine except if I don't have the Range("F2").Select in the event sub the double-click leaves F1 in the edit mode.

I can live with that but the range.select haunts me and I'd really prefer that
F1 became the target cell after the code runs, but NOT in the edit mode.

Thanks.
Howard

(Off topic... I notice a bunch of words are underscored in red. Is this part of the new forum upgrade?)

Option Explicit

Sub MsgBoxNotes()
Dim d As String, e As String, f As String
d = Range("A1")
e = Range("A2")
f = Range("A3")
MsgBox d & vbCr & vbCr & e & vbCr & vbCr & f
End Sub

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim MyIntl As String

If Target = Range("F1") Then
MyIntl = InputBox("Enter your Initials :", "Read Notes.")
If Len(MyIntl) = 0 Then
MsgBox "Enter your initials to read notes", vbCritical
Else
Cells(Rows.count, Range("F1").Offset(1, 0).Column).End(xlUp) _
.Offset(1, 0) = MyIntl
Cells(Rows.count, Range("F1").Offset(1, 1).Column).End(xlUp) _
.Offset(1, 0) = Format(Now(), "dd/MM/yyy hh:mm AMPM")
Range("F2").Select
MsgBoxNotes
End If
End If

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default Get rid of need for F2.Select

Hi Howard,

Am Fri, 3 May 2013 23:52:40 -0700 (PDT) schrieb Howard:

I can live with that but the range.select haunts me and I'd really prefer that
F1 became the target cell after the code runs, but NOT in the edit mode.


write: Cancel=True in your code

Else
Cells(Rows.count, Range("F1").Offset(1, 0).Column).End(xlUp) _
.Offset(1, 0) = MyIntl
Cells(Rows.count, Range("F1").Offset(1, 1).Column).End(xlUp) _
.Offset(1, 0) = Format(Now(), "dd/MM/yyy hh:mm AMPM")
Range("F2").Select
MsgBoxNotes
End If
End If


What should the Else-Part do? Initials in the first empty row in F and
in the correponding cell in G the date? Then try:

Else
Cells(Rows.Count, "F").End(xlUp).Offset(1, 0) = MyIntl
Cells(Rows.Count, "F").End(xlUp) _
.Offset(0, 1) = Format(Now(), "dd/MM/yyy hh:mm AMPM")
MsgBoxNotes
End If
End If
Cancel = True


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default Get rid of need for F2.Select

Hi Howard,

Am Sat, 4 May 2013 09:11:34 +0200 schrieb Claus Busch:

write: Cancel=True in your code


write it in the IF-Statemant for the target. Then you can go to edit
mode in all other cells except F1:
If Target = Range("F1") Then
MyIntl = InputBox("Enter your Initials :", "Read Notes.")
Cancel = True


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 536
Default Get rid of need for F2.Select

What should the Else-Part do? Initials in the first empty row in F and

in the correponding cell in G the date? Then try:


Yes, (and the time) and your code solved everything. So smooth again.

Thanks, Claus.

Howard
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
Select Previously Selected worksheet (and/or select previouslyselected workbook) Dave K Excel Programming 5 December 11th 10 12:03 AM
VBA: Column Select then Data Select then return to cell A1 James C[_2_] Excel Discussion (Misc queries) 3 February 1st 10 11:35 AM
How to Pre-Select items in Multi-Select List on Form MikeZz Excel Programming 2 August 6th 09 06:33 PM
Macro to select cells without a certain value and select a menu it Guy[_2_] Excel Worksheet Functions 9 January 2nd 09 05:21 PM
error - select method failed - (columns.select) PBcorn Excel Programming 3 May 19th 08 10:49 AM


All times are GMT +1. The time now is 04:16 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"