I am having trouble making this work could anyone help please?
Lr2 is H6827 and is variable. I just want to do an F2 and Enter on the cell.
![]()
Range("H" & Lr2).Select SendKeys "{F2}", True SendKeys "{ENTER}", True
I am having trouble making this work could anyone help please?
Lr2 is H6827 and is variable. I just want to do an F2 and Enter on the cell.
![]()
Range("H" & Lr2).Select SendKeys "{F2}", True SendKeys "{ENTER}", True
Why? Why would you want to do that? What are you actually trying to achieve? Using SendKeys is a very bad idea and is not recommended.
Regards, TMS
Trevor Shuttleworth - Retired Excel/VBA Consultant
I dream of a better world where chickens can cross the road without having their motives questioned
'Being unapologetic means never having to say you're sorry' John Cooper Clarke
The file is a download and some of the cells are formatted to text. So I have built a macro to make various changes and this is the last part - I have to put calculations in various cells on the worksheet.
SendKeys was recommended to me years ago as a way to write F2 Enter into a macro. I have hardly ever used it but the one time I come to use it it won't work.
I wasn't aware it was a bad idea and not recommended.
Can you suggest something else?
There are various ways. Text to Columns, Paste Special, macro: format as General and use .value = .value.
It should be possible to record and generalise any of the options.
Can you upload a sample workbook?
Regards, TMS
what type of data is you want to format..?
There is an another way ie. TEXT TO COLUMNS..
For example some time what a data is copied or pasted / Exported then gets converted into text
so we generally have to press F2 on the cell and press ENTER to make it normal..
there is an alternative as well
select the range you want to format..
Press text to columns button and press next ---> next ---> Finish..
It will automatically change the format..
Regards,
Regards,
Vikas Gautam
Excel-buzz.blogspot.com
Excel is not a matter of Experience, its a matter of Application.
Say Thanks, Click * Add Reputation
It's not recommended because it is unreliable and difficult to control. You can end up sending key presses at the wrong time or to the wrong application.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks