How To Work With An Excel Macro In Excel 2007

Previously we posted steps to create, edit, run and debug an excel macro with Excel 2003. Some of our readers, however, are using Microsoft Excel 2007 and we thought we should enable our readers to run the vb code posted on Vertical Horizons. So here is quick walk through of how to work with an excel macro in Excel 2007.

Creating Macro

First step is to create a Macro. For creating a macro, either use Alt + F8 or select ‘View’ from top menu bar, click on ‘Macros’ and select ‘View Macro’ as shown in the image below:

How to create an excel macro in Excel 2007

Clicking on ‘View Macro’ will launch the below window. Type the name of Macro and click on Create button.

Clicking on Create button will launch the Visual Basic editor as below.

Write the code in the editor and save this Macro by closing the editor.

Running Macro

Select worksheet and run the Macro by either using Alt + F8 or select ‘View’ from top menu bar, click on ‘Macros’ and select ‘View Macro’. Select the required Macro and click on “Run” button.


Editing Macro

  • Either use Alt + F8 or select ‘View’ from top menu bar, click on ‘Macros’ and select ‘View Macro’. Select the required Macro. Select the Macro “Compare” and click on “Edit” button.
  • This will launch the Visual Basic Editor.
  • Change the code as required.
  • Save the Macro.

We hope that you like the post. Feel free to give your suggestions and inputs in the comments section below.

  1. Compare two worksheets.

    One sheet has some 40,500 rows and other has about 10,000. Purpose is to find if the entries in smaller file already exist in the bigger file. To make matters complex, only one or two columns in the rows will match. Other columns in the rows may differ. We need to highlight those differences also.

    Please help to create a macro to do so.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">