SendKeys

MikeDBMan

Well-known Member
Joined
Nov 10, 2010
Messages
610
I want to use SendKeys to send F2 (Edit cell) to my spreadsheet, but instead the F2 acts within the VBA editor and brings up the "Classes" information you get when hitting F2 within the editor. How can I sendkeys to F2 (Edit a Cell) and then Enter to "move on" out of that cell, thus calculating the contents of that one cell? Thanks for the help!
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
If you run the code from excel instead of the vba editor then it should send the command to excel.

That said, why not just use Application.Calculate? I don't think that what you're trying to do will actually calcualte that one specific cell anyway. If calculation is set to manual for code execution then nothing will happen, if it is automatic then the sheet will recalc as normal including any precedent cells or volatile functions.
 
Upvote 0
I wish. But I have formulas that do not recalculate regardless of how I try. Nobody has been able to offer any worthwhile suggestions so I thought I'd try this. It works when I manually F2,Enter through the cells. Putting a + sign before the F2 seems to make it actually recalculate. Not 100% sure.
 
Upvote 0
I've had similar issues and never been able to figure out exactly why.

Best ??solution?? that I found was to re-enable calculation (if disabled) then force a full recalc, but even then it seemed to be hit and miss.
 
Upvote 0
Going out on a limb and assuming that you need the formula in that specific cell to be calculated so that the result can be used by a subsequent line of code, you could possibly use the Evaluate command to calculate the formula directly in vba rather than trying to recalculate it in the worksheet.
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top