If you have tasks in Microsoft Excel that you do repeatedly, you can record
a macro to automate those tasks.
A macro is an action that you can run as many times as you want.
When you create a macro, you are recording your mouse clicks and
keystrokes.
There are two ways to make Excel macros.
The first method is to use the Macro Recorder. After activating the recorder,
Excel will record all the steps a user makes and save it as a “process” known
as a macro.
When the user ends the recorder, this macro is saved and can be assigned to
a button that will run the exact same process again when clicked.
This method is relatively simple and requires no inherent knowledge of the
VBA code.
This method will work for simple processes.
The second and more powerful method of creating an Excel macro is to code
one using VBA.
VBA stands for Visual Basic for Applications. Excel VBA is Microsoft’s
programming language for Excel and all the other Microsoft Office programs,
like Word and PowerPoint. The Office suite programs all share a common
programming language.
1 Create a Macro: With Excel VBA you can automate tasks in Excel by
writing so called macros. ...
The MsgBox is a dialog box in Excel VBA you can use to inform the users of
your program.
Before going to create a macro you first bring developers tab in your menu
bar
For that you can go to file in that choose options -> customize ribbon->
Developers
First Method:
S1: