Review the Code

6. Try it: Review the Code

The Macro Code begins with:

Sub AddNewRow()

Where Sub means Subroutine.

 

The next six lines are Comments.

The Comments start with a quote mark. These Comments include the name and description for the Macro.

 

Selection.Insert Shift:=xlDown

This shifts the Rows down (x1Down).

 

The AutoFill is programmed for Weekdays (x1FillWeekdays)

 

What Else Do You See? Look at the Range for this Macro. There is a specific Cell selected ("A20") and a specific Range for the Destination:("A20:A21").

 
That means our Macro adds a new Row at Cell A20. We can do better...

Exam 77-888: Microsoft Excel Expert 2010

4. Working with Macros and Forms

4.1. Create and manipulate macros.

Developer ->Code->Macros-> Edit