View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
helpwithXL helpwithXL is offline
external usenet poster
 
Posts: 28
Default edit cell by macro

hi all,
my problem isn't as simple as it looks from the subject of my post (at
least for me) and its continuation of a previous post.
can someone tell me if its possible to make a cell in excel sheet ready
for editing, by using a macro. that is i want to have the cursor
blinking in the cell so that i can edit the text of the cell by runnig
a particular macro.
my original issue was that i wanted to goto the next line (a line feed)
in the same cell when i press enter key. so i want to change the
defualt behaviour of the enter key, which is to goto next cell. someone
suggested using onkey method but i'm still not able to get cell in edit
mode.
my code.............

Sub testkey()
Application.OnKey "{ENTER}", "LineFeed"
End Sub

Sub LineFeed()
Dim sel As Range
Set sel = Selection
seltxt = sel.Value
withenter = seltxt & vbLf
sel.Value = withenter
End Sub