The purpose of the Workbook_Open() macro is to insure we start with Sheet1 active and the "special" ENTER key active. I placed the following in the workbook code area: Private Sub Workbook_BeforeClose(Cancel As Boolean) I placed the following in the Sheet1 code area: Private Sub Worksheet_Activate() (this makes it easy to call from another sub)Īpplication.OnKey "", "InsertIntoTables" I am assuming that InsertIntoTables() is in a standard module. Say clicking the button with the mouse runs InsertIntoTables(). If there is anything else necessary to provide an answer, I'm happy to supply it. The macro already handles empty or improperly-filed cells in my range.Perform the actions you want to record for your macro. Select From A List Of Macros To run the macro from a list of other macros after you’ve recorded it, don’t click the Button or Keyboard buttons. Currently no other application-wide macros or events are being used. by clicking a button in the Quick Access Toolbar by using a keyboard shortcut 1.Macro to be run is named "InsertIntoTables()" and takes no parameters.Data range will always be in Sheet 1, cells A2:D2.I want it to run from anywhere in the range of A2:D2, selecting A2 when complete (as it does now), and if is pressed while any other cell is selected, or a cell on any other sheet is selected, I want it to move down a cell as it currently does, without running any macro. Currently the macro finishes by selecting A2, the first cell with data, so the user can enter new data or press it again to run it again. My user may use the same data multiple times, so I'd like them to be able to press the key multiple times. I also found this question, which used on the key, but also required the worksheet to change to be of use. I've found this question, but the answer was to use Worksheet_Change and the user didn't need the Enter Key. I'd like to simplify it by having a press of the numeric key run the macro so they can leave their hand on the numeric key area. The user may enter several hundred sets of data in a single sitting, and currently leaves the mouse hover over the button, enters the data, and clicks the mouse without moving it to hit the button. The user enters 4 cells of data (in A2:D2) and runs the macro to populate several tables on several sheets with the data. LONGER VERSION: I have a macro in Excel 2010, and I currently have a button on the sheet that the user presses to run it. The short version of the question: How can I make a macro run in Excel 2010 when the user hits the numeric key within a given range of cells, and whether or not they've changed the spreadsheet since the last running of the macro?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |