Create a Macro in MS Excel Using MS Visual Basic

Dennis Faas's picture

This is a different method for creating a macro in MS Excel 2007. You can use this method if you want to write your own script or if you want to copy and paste a part of another macro into an existing macro. You can also use this method to copy and paste a new macro.

Follow the steps below:If the Developer tab is not available, do one of the following to display it:  

  • Click the Microsoft Office Button, and then click Excel Options.  
  • In the Popular category, under Top Options for working with Excel, select the Show Developer tab in the Ribbon check box.  
  • Click OK.

  To set the security level temporarily to enable all macros, do the following:

  • On the Developer tab, in the Code group, click Macro Security.  
  • Under Macro Settings, click Enable all macros. Ordinarily, you should not do this as you could allow potentially dangerous code to run.  
  • Click OK.  
  • On the Developer tab, in the Code group, click Visual Basic.  
  • If needed, on the Insert menu, click Module.  
  • In the code window of the module, type or copy the macro code that you want to use.  
  • To run the macro from the module window, press F5.  
  • On the File menu, click Close and Return to Microsoft Excel when you are finished writing your macro.

Feel just like a software developer now don't you?

When you become a member at, you have access to this and many, many more articles that include screenshots. Don't delay: visit us today!

Rate this article: 
No votes yet