DEV Community

AspXone
AspXone

Posted on

Recorded Marco in Excel 2007

This is script that we just recorded in Excel 2007 using the "Record Marco" feature. I am going to explain the basics of Recording Marcos in Excel.

What is Recording Marcos?

It means that you can create a macro without coding.
All you have to do is: a set of tasks like add data to cell, add functions and more.
Basically, it allows you to automate in Excel without coding. The code is being written after you record a Marco.

How to record a Marco in Excel?

Open Excel, View Tab > Marcos Group > Click on the dropdown button at bottom of the "Macros option" > Click on "Record Marcos" > Name your Macro, Add a shortcut key and Add a description (You can leave it blank) > Do something like writing numbers or text, using functions or more.

How to stop a recording?

After you have done your recording, you will need to stop it.
View Tab > Marcos Group > Click on the dropdown button at bottom of the "Macros option" > Stop recording

How to play a recording?

View Tab > Marcos Group > Click on Marcos > A dialog box will appear > Select the name of your recorded Marco > Click on the "Run button"

Here is our recorded Marco code:

Sub Macro1()
'
' Macro1 Macro
'
' Keyboard Shortcut: Ctrl+p
'
    Range("A1").Select
    ActiveCell.FormulaR1C1 = "Expense Name"
    Range("C1").Select
    ActiveCell.FormulaR1C1 = ""
    Range("A2").Select
    ActiveCell.FormulaR1C1 = "Milk"
    Range("A3").Select
    ActiveCell.FormulaR1C1 = "Cheese"
    Range("A4").Select
    ActiveCell.FormulaR1C1 = "Bread"
    Range("A5").Select
    ActiveCell.FormulaR1C1 = "Salt"
    Range("A6").Select
    ActiveCell.FormulaR1C1 = "Oil"
    Range("A7").Select
    ActiveCell.FormulaR1C1 = "Fruits"
    Range("D8").Select
End Sub
Enter fullscreen mode Exit fullscreen mode

NOTE: THIS DOES NOT WORK ON WEB VERSIONS OF EXCEL.

Top comments (0)