How Do You Write A Simple Macro In Microsoft Excel?
• Define exactly what is it that you expect your macro to do. While macros are usually short, they’re still programs, so you have to have a clear idea of its final behavior. • Go to Tools->Macro->Macros… in the menu to bring the Macro dialog. Opening the Visual Basic Editor • Enter a name for your macro, select if you want your macro available in all workbooks or just the active one and press “Create”. This will open Microsoft Visual Basic Editor and a new module in it. That’s where you will create your macro. • Adding a code Module Type the code of your macro between the lines “Sub TheNameOfYourMacro()” and “End Sub”. Those are the lines that mark the points where your macro starts and ends. • If you don’t know the exact code you need to make something happen, you can use the “Record New Macro…” option in the Tools->Macro menu. Once you start recording the macro, manually perform the same activities you want your macro to do. Go to the Microsoft Visual Basic Editor to see the code