home » excel » You can use microsoft excel to run. Like any other application of the Microsoft Office suite, the Excel spreadsheet editor can be launched in several ways. Additional options for running a macro on a workbook action

You can use microsoft excel to run. Like any other application of the Microsoft Office suite, the Excel spreadsheet editor can be launched in several ways. Additional options for running a macro on a workbook action

In this article, I will give you a step-by-step example with pictures and a fragment of the simplest ready-made VBA code.

How to execute a VBA macro in Excel

For example, the easiest way to run a macro is to understand but difficult to implement:


Macro program to perform its functions.

Now we can move from simple to even simpler) After all, running macros in this way is very inconvenient. Let's look at some simpler options.

Useful advice! If you want to edit a macro then select it in the list of the tool described above and click on the "Enter" button, rather than using the "Edit" button. Using the enter button, you can always go to the source code of the selected macro. The Visual Basic editor will automatically open exactly in the place where the code for this macro is written. The "Edit" button, unfortunately, does not work the same way for all macros.

Attention! Macros created in Excel add-ins may not be available by default in the Macro dialog box list for security policy purposes. After all, macro names in Excel add-ins are usually hidden from third-party users. But if you enter the correct corresponding value in the "Macro name:" field, then all the buttons in the dialog box will be active. This means that they are ready to work with this macro from the add-on and the user is the author of the add-on or a trusted person.



Running a macro with hotkeys

For each macro in Excel, you can assign your own combination of hot keys. Thanks to this, you can call your macro program when you press a specific key combination on the keyboard. What could be easier?

To assign your own key combination for a specific macro, do this:

Now press your hot key combination to call the selected macro. As you can see, your macro has now been assigned a shortcut key combination.

Note! The Macro Options dialog box provides a field for entering a description of the macro. This description will be available at the bottom when selecting a macro from the list. We recommend that you always sign your macros. This custom tone of Excel ethic will be greatly appreciated when the list is filled with dozens of macros.

Useful advice! Try not to use popular hotkey combinations for working with Excel: CTRL+S; CTRL+A; CTRL+T; CTRL+C; CTRL+V; CTRL+SHIFT+L etc. After all, then their purpose will be changed. In the "Macro Options" window, it is also possible to use the SHIFT key in key combinations. As soon as you give keyboard focus to the "Keyboard shortcut: CTRL+" input field and try to enter a capital letter for the combination, naturally using the SHIFT key on the keyboard, the name of the input field will immediately change to "Keyboard shortcut: CTRL+ SHIFT+".

The result will be a slightly longer combination that allows you to expand the options to bypass commonly used hotkeys.

How to run a macro from the Quick Access Toolbar

Excel allows users to run macros using the Quick Access Toolbar. This panel is located at the very top of the program window by default.

To run a macro using the Quick Access Toolbar, you need to do this:


Now on the quick access toolbar there is one more button for. Just click on it and the macro will immediately run.

Useful advice! To change the appearance of a button for a macro in the "Excel Options" - "Quick Access Toolbar" window, select the macro from the right list of "Customize the Quick Access Toolbar" and click the "Change" button. A small gallery of icons will be offered for the new appearance of the macro launch button from the toolbar.


The main disadvantage of placing a button with a macro on the toolbar is that the button will always be available for other files, even when the file with this macro is closed. And if in such cases you click on the macro start button, then the file where it is located will open and only then the VBA code will be executed.

Run a macro from a button in an Excel worksheet

If you only want to run a macro from within an Excel workbook, where does it contain its source code? In such cases, a great solution would be to create a button on an Excel sheet and assign it to run a specific macro. For this:

After you create a button, you can customize it by changing its size and position on the sheet. To do this, right-click on the button again, and then press the Esc key on your keyboard to hide the context menu. The button will have markers with which you can change its size. Move the mouse cursor over any marker on the edges or corners of the button and hold down the left mouse button and drag, thus changing its size. Now click on the button with the left mouse button and while holding it, move the button across the sheet of the Excel document to any other place. To commit all button changes, click the left mouse button in any area of ​​the sheet (for example, in any cell) outside the button area.

Now if we click on the button with the left mouse button, the VBA code assigned to it will immediately be executed.

MS Excel 2007

What do you do with spreadsheets?

Excel spreadsheets are the second most important program included in the Microsoft Office suite of programs. At the same time, this is the most simple and understandable program with a successful, intuitive interface. If you have ever run the Excel program, then you will agree with this, since even at first glance there is nothing complicated in it.

The very idea of ​​spreadsheets seems to have come to the mind of programmers, thanks to memories of school notebooks with checkered sheets, in which it is convenient to do a variety of calculations: from addition in a column to calculations in large tables. Accordingly, the Excel program window is very similar to a regular notebook sheet.

What can you do with spreadsheets?

Everything you need for work and study. They even can be used instead of a regular calculator. However, the Excel program was developed to solve a wide variety of economic and scientific problems, so it is used with pleasure wherever it is required to make simple, but repeatedly repetitive calculations: calculate the results of laboratory work, balance sheet, draw graphs according to scientific work, and just keep home budget.

Working in Excel is intuitive, as it automates the mathematical operations that everyone learns in school. In addition, Excel, unlike other Microsoft products, is a completely compact and uncluttered system. However, for more fruitful work in Excel, the user needs to know the typical methods for performing certain operations, which will increase the comfort of work and allow automating routine actions. In addition, there are "secrets" of Excel, which the user does not get to on his own very soon. And they make life easier for experienced users and help create easy-to-use spreadsheets.

To start the program, find the icon on the desktop labeled Microsoft Office Excel 2007. Double-clicking on this icon will open the Excel program window with an empty table, as shown in fig. 1.1. The title of the window will read Book1 - Microsoft Excel, and a button with an Excel icon and the label Book1 will appear on the taskbar. This means that a new blank document (spreadsheet) has been created in Excel.

Document files in Excel are called workbooks. Traditional for personal computers, the actions of opening, closing and saving files in Excel are performed with books.

The book consists of worksheets. Each worksheet has a name that appears on its label. By default, sheets are named: Sheet1, Sheet2 etc. To activate a sheet, click on its label.

Workspace each sheet is a table. The columns of the table are titled with Latin letters and, further, with two-letter combinations. There are 256 columns in total in the worksheet (from BUT before IV). Lines are numbered from 1 to 65536.

The minimum data storage element is cell .

cell address - this is the column heading and row number at the intersection of which the cell is located, for example, A2, B25, C65.

One of the cells is always active (current) and is highlighted with a frame. Data entry and editing operations are always performed in the active cell. You can make another cell active (move the cursor frame) in several ways:

click the mouse in the desired cell;

use the navigation arrow keys;

press a key < Enter> .

Below the toolbars of the Excel window is formula bar .
The left side of this line displays the address of the current cell (or its name), the right side shows the contents of the current cell. Between the address field and the content field there are buttons:

- opens a list of named cells (for quick access to them), and when entering a formula - a list of 10 functions that were used last;

– calls the Function Wizard window,

When you start entering data from the keyboard into a cell, two more buttons appear in the formula bar:

– cancel input (equivalent to the key ).

– entering data into a cell (equivalent to ).

reference system

The help system in the Microsoft Office 2007 software package contains several levels of help information, designed for both novice users and professionals. If you are working in Excel for the first time, you can easily find a description of the simplest working methods in the help system. If you have experience in Excel, then the help system will be a handy tool for daily activities. A professional will find it convenient to use the help system when you need to find help on a rarely used formula or clarify a number of subtleties of programming in spreadsheets.

The very first level of the help system is context help(pop-up small window). It is very convenient for beginners, as well as for those who have worked with previous versions of Excel. To obtain detailed reference information, a reference window, traditional for computer programs, with hyperlinks and thematic sections is used.

NOTE

In Excel, the F1 function key on the keyboard works, with the help of which the help system window is called. If you do not know what to do next, and have questions, then press this key.

In difficult situations, you can enter in the line (located to the left of the Search button) a word or several words that are relevant to your problem. After clicking the Search button in the Help window, a list of hyperlinks to the topic of interest to you will be displayed.

If you already have Microsoft Office 2013 installed on your computer, you can immediately launch Microsoft Excel 2013 and start exploring it in depth. If you are just going to install it, refer to the installation article. It discusses in detail the process of installing Microsoft Office 2013. In this article, we will look at the launch of Microsoft Excel 2013 and the main issues related to creating documents.

If you have a Windows 8 operating system installed on your computer, to launch Microsoft Excel 2013, you need to move to the right on the start screen using the scroll bar (to see the tiles that do not fit on the screen) and click on the Excel icon (it is green). An example of the location of this icon on the home screen is shown in fig. 1.1.

If you are using the Windows 7 operating system, click on the button Start, in the menu that appears - on the Microsoft Office 2013 folder, and then in the drop-down list - on the Excel 2013 item (Fig. 1.2). As a result of these actions, the start window of Microsoft Excel will open (Fig. 1.3).

Here you need to immediately clarify that the document you are working with in Microsoft Excel is called a book. The start window allows you to select a book that you have worked with before from the list on the left side of the window, or create a new book. Moreover, you can create an empty book, or you can create a book based on a template. Sample- this is a blank book with pre-made inscriptions and other elements. Templates help you quickly create documents of the same type. If you are creating a book for the first time, click on the Blank Book item as shown in Figure 1. 1.3.

A window will open with the caption book1- Excel and a blank sheet with a grid separating cells in the workspace of the window. You can get to work.

If you often use macros in MS Excel, then I'm sure you've had the question more than once: "How to quickly run a written macro?". You can bind a hot key, for example. We will also tell you how to make the macro available from any Excel file and you can make a quick macro launch in Excel.

If you do not know what is at stake, then I advise you to read. In short, a macro is a list of actions written using the VBA "language". It is very convenient to write down such a sequence if you often perform the same operations (they can be written down with a special tool - ). The macro will execute them when pressed.

The most convenient way to work with macros and related tools is to bring the Developer tab to the toolbar

It turns on easily - go to the left, top button Excel Options - General section - in the right window, check the box Show the Developer tab on the ribbon

As we can see, there is a large selection of tools here, from the ability to enter Visual Basic to inserting an object, such as a button.

You can run a macro by pressing the second button on the left Macros.

A macro selection window will appear

Select the one you want and click Run.

Running a macro in Excel. Hotkeys

Opening the macro selection window can be done through the hot key. And go to the macro editing window with a combination .

Moreover, if you select the desired macro in the selection window and click Options, then you can bind a keyboard shortcut to the macro.

In this case, ctrl + Y.

Autorun macro on book open

Go to the macro editing window or click the View Code button on the Developer panel.

VBA will open. Your macros (especially those recorded with a macro recorder) will be stored in a separate module section in the left pane.

In order for the macro to run when a book is opened, it must be moved to the This book section.

Copy the macro body from the right window (between Sub and End Sub)

Select ThisBook in the left pane (double left click).

In the upper panels, select Workbook and the flag for enabling the macro Open (opening the book is obtained).

Paste the copied macro text from the module between Private Sub and End Sub. We save. Close VBA.

Ready! The macro will run when the book is opened.

Additional options for running a macro on a workbook action

As you can see when selecting Workbook, there are many options available in the right selection box. Below are the commands that run the macro on a workbook action:

  • Activate - when activating a book (when moving from another window to this book);
  • Deactivate - when switching to another book;
  • BeforeClose - before closing the book;
  • BeforePrint - before printing the book;
  • BeforeSave - when saving a book;
  • NewSheet - when creating a new worksheet.

Additional options for running a macro on a sheet action

By analogy with the previous paragraph, the same actions can be tied to a specific sheet. Below are the commands that run the macro on a sheet action:

  • SheetActivate - when a sheet of a book is activated;
  • SheetDeactivate - when switching to another sheet of the book;
  • SheetCalculate - when recalculating formulas on a sheet;
  • SheetBeforeDoubleClick - before double-clicking the mouse;
  • SheetBeforeRightClick - before right-clicking;
  • SheetChange - when changing on a sheet

If you need to run a macro when a cell changes, you can find detailed instructions in this one.

Ready to answer questions in the comments!

Share our article on your social networks:

From the Start menu, select All Programs, and then Microsoft Office Microsoft Office Excel 2003 (Fig. 11.2);

Double-click the left mouse button on any Excel workbook in the Open Office Document dialog box.

If you have already launched Microsoft Excel and then switched to other programs, left-click on the minimized Excel window on the taskbar to open it.

Main window of Excel

On fig. 11.3 shows the main window of the spreadsheet editor Microsoft Excel. It shows the following elements:

1. Cursor - a rectangle with a thickened border surrounding the active cell along the perimeter. To select another cell, click inside it with the left mouse button. Alternatively, use the arrow keys, Tab or Enter, or use the keyboard shortcut Shift+Tab or Shift+Enter.

2. Menu bar. Click on any item to open the corresponding menu.

3. The formula bar displays the contents of the active cell. You can enter and change data right here or in the cell itself.

4. On the Standard toolbar there are buttons that, when pressed, execute standard commands that allow you to work with files, edit text, etc.

5. The buttons on the Formatting toolbar are for formatting cells and their contents.

6. Clicking on a column heading selects the entire column. Drag the mouse pointer over multiple headings while holding down the left mouse button if you want to select multiple columns.

7. Using the scroll buttons, you can view the entire sheet of the Excel workbook on the screen, as well as move to the next, previous, first, or last sheet of the workbook.

8. Click the row header to select the entire row. Drag your mouse across multiple headings to select a series of lines.

9. Sheet tabs. By clicking on the tabs, you will alternately display different sheets on the screen. If you need to rename a sheet, double-click on its tab and type in a new name.

10. And the status bar displays information about the current sheet or operation in progress.

11. Mode indicators register the inclusion of special modes, for example, the mode of changing the case of letters (while pressing the Caps Lock key).

12. The task pane provides quick access to Excel documents, clipboard, search options for files and objects of the Clip Collection (Clipart).

13. Assistant (Office Assistant) - a program that displays information from sections of the help system of the Microsoft Excel package.



Previous article: Next article:

© 2015 .
About the site | Contacts
| site `s map