+ Reply to Thread
Results 1 to 5 of 5

VBA macro to reproduce the F2 key in Excel

  1. #1
    Registered User
    Join Date
    04-16-2019
    Location
    Lyon
    MS-Off Ver
    2016
    Posts
    4

    VBA macro to reproduce the F2 key in Excel

    Hello everyone,

    I would like to reproduce the F2 key on Excel via a VBA code.
    The F2 key allows you to enter a cell and see the formula inside/the raw data.
    Also, for a formula referring to cells, it shows where they are positioned with colours.
    (Just press F2 on an Excel cell with a formula to see what I mean if it is not clear).

    I tried the following code, but it does not work: ActiveCell.FormulaR1C1 = "=R[-1]C"

    I thank you in advance for your help.

    I wish you all a nice day.

  2. #2
    Registered User
    Join Date
    04-19-2021
    Location
    Dublin, Ireland
    MS-Off Ver
    O365, Win10 and Mac
    Posts
    47

    Re: VBA macro to reproduce the F2 key in Excel

    Have you tried

    SendKeys "{F2}"

  3. #3
    Registered User
    Join Date
    04-16-2019
    Location
    Lyon
    MS-Off Ver
    2016
    Posts
    4

    Re: VBA macro to reproduce the F2 key in Excel

    It doesn't work..

  4. #4
    Forum Expert
    Join Date
    10-11-2021
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    1,406

    Re: VBA macro to reproduce the F2 key in Excel

    It does, assign the macro to a butoon and close your VBA editor before you use the macro

    Use it like below to prevent NumLock issues.

    Please Login or Register  to view this content.
    or

    Please Login or Register  to view this content.
    Last edited by JEC.; 11-12-2022 at 02:04 PM.

  5. #5
    Registered User
    Join Date
    04-16-2019
    Location
    Lyon
    MS-Off Ver
    2016
    Posts
    4

    Re: VBA macro to reproduce the F2 key in Excel

    Thanks Jec for your answer.

    I used your code, it works but I do have the NumLock problem... Do you have any ideas how to remove the NumLock problem please?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Reproduce chart
    By Villalobos in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 11-24-2017, 08:03 AM
  2. Reproduce speedometer chart
    By Villalobos in forum Excel Charting & Pivots
    Replies: 5
    Last Post: 07-23-2016, 02:53 PM
  3. macro to scan each column and reproduce specific cells to different sheet
    By scano.ie in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-06-2015, 07:22 PM
  4. [SOLVED] Reproduce Feature in Microsoft's Excel Template
    By Sawyier in forum Excel General
    Replies: 1
    Last Post: 02-06-2014, 02:35 PM
  5. Is it possible to reproduce this investment calculator? *screenshot
    By dcharlesworth in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-15-2008, 06:02 AM
  6. reproduce attached graph
    By MarsyasX in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 02-09-2008, 10:33 PM
  7. Can anyone reproduce my Chart error? Is this an Excel BUG?
    By Philip_plf in forum Excel Charting & Pivots
    Replies: 6
    Last Post: 02-14-2005, 02:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1