Beruflich Dokumente
Kultur Dokumente
2. Under Customize the Ribbon, on the right side of the dialog box, select Main tabs (if necessary).
3. Check the Developer check box.
4. Click OK.
5. You can find the Developer tab next to the View tab.
Command Button
To place a command button on your worksheet, execute the following steps.
1. On the Developer tab, click Insert.
2. In the ActiveX Controls group, click Command Button.
Assign a Macro
To assign a macro (one or more code lines) to the command button, execute the following steps.
1. Right click CommandButton1 (make sure Design Mode is selected).
2. Click View Code.
Note: the window on the left with the names Sheet1, Sheet2 and Sheet3 is called the Project Explorer.
If the Project Explorer is not visible, click View, Project Explorer. To add the Code window for the first
sheet, click Sheet1 (Sheet1).
5. Close the Visual Basic Editor.
6. Click the command button on the sheet (make sure Design Mode is deselected).
Result:
NEW ONE
Method 1
Excel 2007 and 2010
1. 1
Click the Developer tab on the Ribbon at the top of the screen. If
the tab is not showing up on your screen, you can add it as follows:
For Excel 2010: click the File Tab then select options. On the left
hand side of the Excel options dialog box, click Customize Ribbon.
Then, on the right hand side box select Developer.
For Excel 2007: click the Microsoft Office button, then Excel Options.
In the Popular category, under Top Options for Working with Excel,
select Show Developer Tab in Ribbon.
<img alt="Image titled Write a Simple Macro in Microsoft Excel Step 2"
src="http://pad1.whstatic.com/images/thumb/4/4c/Write-a-Simple-Macroin-Microsoft-Excel-Step-2.jpg/aid229922-728px-Write-a-Simple-Macro-inMicrosoft-Excel-Step-2.jpg" width="728" height="546" class="whcdn">
2
Change the security settings. In Trust Centre, Under Macro Settings,
click Enable All Macros, then click OK.
Note that this security setting is not ideal for basic use. When
you've finished creating your macro, go back and un-click Enable All
Macros.
3
Click Record Macro. You'll find it on the Developer tab under Code.
<a href="http://us-ads.openx.net/w/1.0/rc?
cs=b0a175c203&cb=1459247101607&url=http%3A%2F
%2Fwww.wikihow.com%2FWrite-a-Simple-Macro-in-MicrosoftExcel&c.width=726&c.height=106&c.tag_id=21083&c.taglink_id=38041&
c.scale=1.0027548&c.url=http%3A%2F%2Fwww.wikihow.com%2FWrite-aSimple-Macro-in-Microsoft-
Excel&c.params=&c.impression_type=26&c.placement_id=ad0.15321764
61000796" ><img src="http://us-ads.openx.net/w/1.0/ai?
auid=538214314&cs=b0a175c203&cb=1459247101607&url=http%3A
%2F%2Fwww.wikihow.com%2FWrite-a-Simple-Macro-in-MicrosoftExcel&c.width=726&c.height=106&c.tag_id=21083&c.taglink_id=38041&
c.scale=1.0027548&c.url=http%3A%2F%2Fwww.wikihow.com%2FWrite-aSimple-Macro-in-MicrosoftExcel&c.params=&c.impression_type=26&c.placement_id=ad0.15321764
61000796" border="0" alt=""></a>
4
Name your macro. The first character of the name must be a letter; after
that, you can use characters, numbers and underscores. Macro names
cannot have spaces.
Don't use the same name for your macro as an existing cell
reference.
5
Set a shortcut for your macro (optional). Type a letter in the Shortcut
Key box. A lowercase letter will translate to CTRL + letter; an uppercase
letter will be CTRL + SHIFT + letter.
6
Choose where to store your macro. In the Store Macro In list, select
the workbook where you want to store the macro. If you want it to be
available whenever you run Excel, select Personal Macro Workbook.
7
Describe your macro. Write this in the Description box.
8
Click OK to start recording your macro.
9
Perform the actions you want the macro to record.
10
Stop recording. Go to the Developer tab, click Code, then click Stop
Recording.
Method 2
Excel 2003
1. 1
Change the security level. Switch the security level from Medium to
Low.
2
Start recording your macro. Navigate to Tools -> Macro -> Record New
Macro.
3
Name your macro. The character of the name must be a letter; after
that, you can use symbols, numbers or underscores. No spaces are
allowed.
Don't use the same name for your macro as an existing cell
reference.
4
Code a shortcut for your macro (optional). Enter a letter in the
Shortcut Key box. A lowercase letter will make the shortcut CTRL + letter;
uppercase will be CTRL + SHIFT + letter.
5
Choose where to store your macro. In the Store Macro box, select a
location for your macro. Click Personal Macro Workbook if you want it
to be available whenever you open Excel.
6
Write a description of your macro.
7
Record your macro. Remember, Record Macro is still on. Carry out the
actions that you want Excel to record as your macro.
8
Click Stop Recording. You can find this option on the Stop Recording
toolbar.
Unanswered Questions
Answered Questions
Don't see your question? Ask it here:
Submit
Tips
If you already know the code for your macro, you can enter it in the
Microsoft Visual Basic Editor. In Excel 2007 and 2010, it's located under
the Developer tab, in Code. In Excel 2003, click Tools -> Macro -> Visual
Basic Editor.
You can make your macro behave as one of Microsoft Excel's formula
functions so you can use it inside the spreadsheets to calculate things.
Basically you have to change your "Sub" to a "Function", add parameters
and return a value, but this is explained in its own how-to, look for it in the
related wikiHows section.
Use the Range, Sheet and Workbook objects to interact with the
information in your worksheets. The ActiveWorkbook, ActiveSheet and
Selection objects point to the current book, sheet and range of cells in the
Application.
The forums at ExcelForum are filled with helpful people who will work hard
to answer your politely asked Excel questions.
Warnings
Due to security measures, some people may disable macros. Make sure
you let your colleagues know the book you're sending them has macros
and that they can trust they're not going to damage their computers.