Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   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

thanks, i didn't think of it but luckily for me the date and my windows are
in dmy format, rgds, david

"Dave Peterson" wrote:

Be careful.

If I do this kind of thing with my USA settings (mdy order), I may end up with
dates--but they may not be the ones I want.

For instance:
01/02/03
would change to
January 2, 2003
for me.

If your windows regional settings have your short date in dmy format, you should
be ok. But you may want to make a note of a value and then do your conversion.
Then give that cell an unambiguous date format (mmmm dd, yyyy) to see if it's
what you expect.

I like to do this if my "dates" are in a single column
select the column
data|text to columns
fixed width (remove all lines)
and choose date dmy (to match the data)
and finish up.

If I need a macro, I'd record one when I did it manually.

dn wrote:

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


--

Dave Peterson

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
Excel-hitting tab moves me more than one column over dk Excel Discussion (Misc queries) 1 April 26th 06 12:24 AM
how to release anchored cell in EXCEL when hitting "esc" fails? L Excel Discussion (Misc queries) 1 April 15th 06 01:03 AM
How can I create a new line in a cell in Excel by hitting enter? Monica Excel Discussion (Misc queries) 4 July 1st 05 06:32 PM
hitting spacebar in excel deletes last character entered. badgercat New Users to Excel 0 March 14th 05 09:47 PM
excel macro - macro initiation upon hitting the ener key arunjoshi[_2_] Excel Programming 1 April 28th 04 09:58 PM


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