View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
DN DN is offline
external usenet poster
 
Posts: 12
Default i'm looking for VB code that does the same as hitting F2 in ex

Many thanks, this worked perfectly.
in a nut shell, i imported dates into excel in dd/mm/yy , for some reason
excel read it as if it was text and not a number, however, i found out that
if you just used F2 and Enter, it was able to read it as a number so i was
trying to do this through a macro. your proposal worked just fine.
many thanks

"Dave Peterson" wrote:

I don't know what you're doing, but sending keystrokes is not usually a good way
to do things.

Maybe:

with activecell
.value = .value
'or
.formula = .formula
end with

There may be much better ways of doing what you need.

dn wrote:

Many thanks, can you pls let me know what's the key name for "Enter"
i have tried :
Application.SendKeys "{F2}"
Application.SendKeys "{Enter}"
and it doesn't work

rgds, david

"witek" wrote:

dn wrote:
when you record a macro hitting the F2 in a cell that contains 444, the
result is:
ActiveCell.FormulaR1C1 = "444"
i would like the code just to record the action of hitting the F2 not of
writing the existing cell formula



Application.SendKeys "{F2}"


--

Dave Peterson