Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Use VBA to open an Excel cell for Edit

Hi,
How do I open a cell for edit from code ie as if the user
had pressed F2...
Regards
Michael Green
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Use VBA to open an Excel cell for Edit

Sub AAAtest()
Cells(1, 1).Select
SendKeys "{F2}"
End Sub

--
Regards,
Tom Ogilvy



Michael Gree wrote in message
...
Hi,
How do I open a cell for edit from code ie as if the user
had pressed F2...
Regards
Michael Green



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Use VBA to open an Excel cell for Edit

Tom,
Many thanks for that - it worked.

However I'm concerned that SendKeys only works on the
Active window. Do you know a way to ensure the key
strokes go to the correct window ?

Regards
Michael


-----Original Message-----
Sub AAAtest()
Cells(1, 1).Select
SendKeys "{F2}"
End Sub

--
Regards,
Tom Ogilvy



Michael Gree wrote in

message
...
Hi,
How do I open a cell for edit from code ie as if the

user
had pressed F2...
Regards
Michael Green



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Use VBA to open an Excel cell for Edit

You can only edit in the active window, so that shouldn't be an issue.

I am not sure why you want to do this, but if you want to change the value
in a cell, you certainly don't need to put excel into edit mode (where code
doesn't run anyway).

--
Regards,
Tom Ogilvy


Michael Green wrote in message
...
Tom,
Many thanks for that - it worked.

However I'm concerned that SendKeys only works on the
Active window. Do you know a way to ensure the key
strokes go to the correct window ?

Regards
Michael


-----Original Message-----
Sub AAAtest()
Cells(1, 1).Select
SendKeys "{F2}"
End Sub

--
Regards,
Tom Ogilvy



Michael Gree wrote in

message
...
Hi,
How do I open a cell for edit from code ie as if the

user
had pressed F2...
Regards
Michael Green



.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Use VBA to open an Excel cell for Edit

Tom,
Thanks for that.

The reason I want the cell open for editing is as a nicety
for the user. Before this last line of code there is code
to insert a new row, specially format it with validation
etc. I then position the active cell so the user can
start entering data.

Regards
Michael Green


-----Original Message-----
You can only edit in the active window, so that shouldn't

be an issue.

I am not sure why you want to do this, but if you want to

change the value
in a cell, you certainly don't need to put excel into

edit mode (where code
doesn't run anyway).

--
Regards,
Tom Ogilvy


Michael Green wrote in

message
...
Tom,
Many thanks for that - it worked.

However I'm concerned that SendKeys only works on the
Active window. Do you know a way to ensure the key
strokes go to the correct window ?

Regards
Michael


-----Original Message-----
Sub AAAtest()
Cells(1, 1).Select
SendKeys "{F2}"
End Sub

--
Regards,
Tom Ogilvy



Michael Gree wrote in

message
...
Hi,
How do I open a cell for edit from code ie as if the

user
had pressed F2...
Regards
Michael Green


.



.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 550
Default Use VBA to open an Excel cell for Edit

Michael,

Getting back to what Tom said..why would you want to do this?
As long as you're in VBA, create a UserForm and let the user
enter data into a textbox. You can validate the data in the textbox
a lot easier than in a cell and when (via coding) you're certain
it's correct, write it to the cell in whatever format you want.

John

"Michael Green" wrote in message
...
Tom,
Thanks for that.

The reason I want the cell open for editing is as a nicety
for the user. Before this last line of code there is code
to insert a new row, specially format it with validation
etc. I then position the active cell so the user can
start entering data.

Regards
Michael Green


-----Original Message-----
You can only edit in the active window, so that shouldn't

be an issue.

I am not sure why you want to do this, but if you want to

change the value
in a cell, you certainly don't need to put excel into

edit mode (where code
doesn't run anyway).

--
Regards,
Tom Ogilvy


Michael Green wrote in

message
...
Tom,
Many thanks for that - it worked.

However I'm concerned that SendKeys only works on the
Active window. Do you know a way to ensure the key
strokes go to the correct window ?

Regards
Michael


-----Original Message-----
Sub AAAtest()
Cells(1, 1).Select
SendKeys "{F2}"
End Sub

--
Regards,
Tom Ogilvy



Michael Gree wrote in
message
...
Hi,
How do I open a cell for edit from code ie as if the
user
had pressed F2...
Regards
Michael Green


.



.



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
If i open a 2003 excel document in excel 2007 can i edit it ? kt Excel Discussion (Misc queries) 1 May 18th 09 02:47 PM
Can I open, edit and save an Excel file online? Troop Excel Discussion (Misc queries) 1 October 24th 08 10:52 PM
Multiple excel users can open the same file and edit at the same . Jeff Howard Excel Discussion (Misc queries) 1 February 18th 05 12:19 PM
Excel open an existing MS Query in edit mode via macro attached to a button. systems analyst Excel Programming 1 October 3rd 03 12:08 PM
Programmatically open / edit vba-editor hglamy[_2_] Excel Programming 1 September 4th 03 03:32 PM


All times are GMT +1. The time now is 03:42 PM.

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

About Us

"It's about Microsoft Excel"