F2 enter

igordep

New Member
Joined
Jun 25, 2011
Messages
4
Hi,
Probably already handled in the past (although I can't find something in the archive), but I am in need of an excel macro that will be able to let me F2 (edit cell) on a certain range

Thanks for the help
Igor
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Below code is same as Opening Cell in Edit mode and Hitting Enter for listed Range:
Code:
Sub TestF2Enter()
    Set Rng = Sheets("Sheet1").Range("A1:D5")
    For Each c In Rng
        MyStuff = c.Formula
        c.Formula = MyStuff
    Next c
End Sub
 
Upvote 0
Hello John,

Thanks for your answer, but your code does not have the same result as F2 + enter... I have a formula in my VBA code which results in #NAME?
when I go into the cell (via F2) and enter, the #NAME? changes in the correct result of the formula, so I should need code to do this in each cell in my range (+- 1000 lines);
fyi, the formula I have in my code is a very simple one: if(B1>1;D1-C1;"")
maybe it's just a general cell formatting problem... I'm far from an expert

in case you should know how to solve this, thanks in advance for your answer !

Best regards,
igor
 
Upvote 0
Change the semicolons to commas.

Denis

I would guess that the semicolons are correct Denis, used in place of commas to delimit formula with some european language settings.

If FormulaLocal doesn't work, maybe Sendkeys would be the easiest way.
 
Upvote 0
I believe Denis was simply informing OP to use US centric delimiters when writing formulas to worksheet via VBA
(FormulaLocal is however sometimes easier for the developer pending their familiarity with US delimiters)
 
Upvote 0
igor,

I would suggest posting the code you are using to insert the formula in the first instance... you should not need to use SendKeys.

To elaborate on the advice given previously by means of example:

US-Centric Delimiters using Formula property

Code:
Range("E1:E1000").Formula = "=IF(B1>1,D1-C1,"""")"

the above will convert to Local delimiters automatically when posted to the worksheet object

Local Delimiters using FormulaLocal property:

Code:
Range("E1:E1000").FormulaLocal = "=IF(B1>1;D1-C1;"""")"
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,585
Messages
6,179,700
Members
452,938
Latest member
babeneker

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