+ Reply to Thread
Results 1 to 5 of 5

How to create macro with keystrokes to be used anywhere w/o a range

  1. #1
    Registered User
    Join Date
    07-21-2015
    Location
    California
    MS-Off Ver
    2010/365
    Posts
    2

    How to create macro with keystrokes to be used anywhere w/o a range

    Can you please solve a BIG headache & mystery for me?

    I am trying to create a macro to replicate keystrokes so that I can use it anywhere within the spreadsheet. I don't know how to replicate keystrokes without Excel using the exact range of cells where I am located and jumping back to that spot. I want it to be "movable" to other parts of the spreadsheet.

    Feel free to use a different example in your solution, as long as it explains how to use non-relative keystrokes that can be used anywhere in the spreadsheet (i.e., press a particular key, or set of keys, a certain number of times).

    Example: create a formula by:
    1) On the current selected cell (F559), type the = sign (to start a new formula)
    2) Press UpArrow key twice (to select the cell two up from where my formula is: F557)
    3) Press F4 key twice (to toggle & get the F$557 absolute reference I want)
    4) Press * (asterisk symbol to multiply)
    5) Press LeftArrow key once (to select the adjacent cell one to the left)
    6) Press F4 key three times (to toggle & get the $E559 absolute reference I want)
    7) Press Ctrl+Enter (to save the formula without moving from the selected cell)
    8) Press Ctrl+C (to copy formula in selected cell)
    9) Press Ctrl+Shift+DownArrow (to select the rest of the range below)
    10) Hold Shift and press RightArrow key two times (to select cells in two more rows to the right)
    11) Press Enter (to paste the formula in selected cell range)

    The idea is that I can use the same relative movements based on the selected cell I start with, since this is a section of about 10 lines that gets copied/pasted as new rows with different data in the top cells of columns F, G and H.

    Thanks a million for your help!!
    Last edited by dd.oliver; 07-21-2015 at 07:14 PM.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,936

    Re: How to create macro with keystrokes to be used anywhere w/o a range

    Post the recorded macro.
    Ben Van Johnson

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: How to create macro with keystrokes to be used anywhere w/o a range


    No needs keystroke (worse idea !) but just a bit of logic using relative reference from active cell …

    Just respect Excel objects model, most efficient way !

  4. #4
    Registered User
    Join Date
    07-21-2015
    Location
    California
    MS-Off Ver
    2010/365
    Posts
    2

    Re: How to create macro with keystrokes to be used anywhere w/o a range

    The problem is that, with the macro I created with the steps I detailed here, it only works in that same set of cells. If I copy/paste the 10 rows below to input new data, the macro takes the selection point back to the location of the original cells I selected when recording the macro (i.e., 10 rows higher), so it runs the steps on the wrong set of cells.

    I am not familiar with other alternatives. Any help on that?

  5. #5
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: How to create macro with keystrokes to be used anywhere w/o a range



    Start to read Activecell and Offset properties inner VBA help …

+ 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. Macro to record keystrokes
    By RM-Vallejo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-18-2013, 11:11 PM
  2. Run macro with keystrokes
    By capngene in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-14-2012, 10:47 PM
  3. How do I get a macro to record keystrokes
    By JJBrune in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-01-2011, 03:35 PM
  4. Macro question-how to get it to record keystrokes
    By jerrydixon in forum Excel General
    Replies: 2
    Last Post: 12-21-2009, 09:00 PM
  5. [SOLVED] Macro to record keystrokes and not cell addresses
    By Brian William Johnston in forum Excel General
    Replies: 3
    Last Post: 05-17-2006, 04:35 PM
  6. how to get a macro to record F2, Home, Delete keystrokes
    By jenonstx in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-22-2005, 02:05 AM
  7. [SOLVED] Special keystrokes in a Macro
    By Eric in forum Excel General
    Replies: 4
    Last Post: 05-18-2005, 10:06 AM
  8. How do I create a macro of editing keystrokes?
    By scjanner in forum Excel General
    Replies: 0
    Last Post: 01-21-2005, 08:06 PM

Tags for this Thread

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