LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 441
Default VBA command for edit cell mode

Bernie,

Thanks for your help. Just two things:

Actually, I do need an Edit method because I have code attached to a
double-click event in the sheet and I want to give the user the choice to
edit the cell as they normally would...I guess I can use:
Application.SendKeys "{F2}"

Thanks much for the method to capture the user's previous selection. Do you
find that using "Worksheet_SelectionChange" reduces response time in large
spreadsheets? I have never used this event as it seems to me that it could
affect performance?...

Again thanks.

"Bernie Deitrick" wrote:

quartz,

You don't really need to enter edit mode. You can use the inputbox method
to get the user's input. For example, to get the user to change the value
in cell A1:

Range("A1").Value = Application.InputBox("Edit A1", , Range("A1").Value)

To capture the user's last selection, you need to use 2 global range
variables, and the worksheet selection change event. In a standard module,
declare these at the top:

Public OldRange As Range
Public CurRange As Range

Then in the worksheet change event:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Set OldRange = CurRange
Set CurRange = Target
If OldRange Is Nothing Then Exit Sub
MsgBox "The last selection was " & OldRange.Address
End Sub

Of course, OldRange will be available to you anywhere in your code.

HTH,
Bernie
MS Excel MVP


"quartz" wrote in message
...
I am using Windows XP with Office 2003.

1. I need a VBA method to enter edit mode within a cell. As though the

user
double clicked in a cell or pressed F2. Or must I use send keys?

2. Is there a way to capture the user's previous selection? For example,
user makes a selection one, then makes selection two. I need the range
address for selection one.

Could someone please post example code for these questions?

Thanks much in advance.




 
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
Disable cell reference insertion with PageUp in cell edit mode. Greta Excel Discussion (Misc queries) 0 May 21st 08 03:54 PM
Is it possible to arrow to a different cell while in edit mode? Latka2k Excel Discussion (Misc queries) 1 December 9th 05 09:51 PM
Combo Box goes to edit mode even if design mode is in OFF position Chas Excel Discussion (Misc queries) 0 January 7th 05 07:21 PM
cell value in edit mode with COM addin Julian Tucker Excel Programming 0 September 7th 04 11:51 AM
Detecting Cell Edit Mode Marc[_15_] Excel Programming 1 December 3rd 03 11:09 PM


All times are GMT +1. The time now is 07:38 AM.

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"