You don't have access to this class

Keep learning! Join and start boosting your career

Aprovecha el precio especial y haz tu profesión a prueba de IA

Antes: $249

Currency
$209
Suscríbete

Termina en:

1 Días
0 Hrs
53 Min
5 Seg

Macros - grabando macros

36/38
Resources

How to record a macro in Excel?

Recording macros in Excel is a productivity-boosting skill that automates repetitive tasks. If you have already explored how to create macros by writing code, recording them will give you even more options to customize and reuse them. Below, you will learn how to create and modify your first recorded macro step by step.

How to enable the developer tab?

Before you start, you must make sure that the "Developer" or "Programmer" tab is enabled in your Excel, as this is where the macro management functions are located. If you have not enabled it yet, follow these steps:

  1. Right-click on the toolbar.
  2. Select "Customize Ribbon".
  3. Check the "Developer" box and accept the changes.

How to record a simple macro?

Let's create a simple macro that will move the text "Platzi" to a specific cell and format it. Macro recording in Excel captures all your actions and transforms them into code.

  1. Go to the Developer tab and select "Record Macro".
  2. Name your macro, e.g., "grab1".
  3. Everything you do now in Excel will be recorded:
    • Go to cell A10 and type in the word "Platzi".
    • Change the color of the text to green using Platzi's RGB code (152, 262).
  4. Stop recording the macro.

To view and edit the generated code:

  • Open the Visual Basic Editor by pressing Alt + F11.

How to use macros with the Find Target tool?

An advanced use of macros is their application with the "Find Target" tool, useful for finding specific values that generate a desired result.

  • Record a macro, for example, "Find 50", and use the tool to find the value that allows a cell to reach 50 by modifying another associated value.
  • Be sure to record the whole process, from selecting the cell to be modified to clicking OK.

How to assign macros to buttons?

You can make these macros more accessible by assigning them to buttons that can be inserted directly into your spreadsheets.

  1. Go to Developer > Insert and choose a button.
  2. Assign the macro you want to run to the newly created button.
  3. Change the button text if you wish by right-clicking.

Each time you click the button, the macro will run automatically, allowing you to change values and apply the corresponding modifications without having to manually repeat the procedure.

How to create dynamic macros for hypothesis analysis?

Finally, you can create macros that use controls such as slider buttons to perform more sophisticated hypothesis analysis. This approach allows you to link changes in the data with immediate results.

  1. Create the necessary control from Developer > Insert.
  2. Configure it with the macros you want to automate, allowing instant effects when you move the controls.

Challenge: How to use macros to solve complex problems?

Based on the knowledge you have acquired, try to solve the following challenge: "What number should be modified so that the resulting value in a specific calculation is 1,829?" Use the macro created in this class and adjust the code if necessary. Continue learning and researching to hone your macro creation skills by using online resources and experimenting with different types of code.

Macro programming not only speeds up processes, it also multiplies the possibilities for data analysis and presentation. Ready to take the next step in your Excel mastery?

Contributions 133

Questions 11

Sort by:

Want to see more contributions, questions and answers from the community?

Esto no es para meterlo dentro de un curso de excel, esto merece un curso a parte y entero la verdad

conoceran algún link ó recurso (libro) donde pueda ver casos donde aplicar las macros?, en el video nos enseñó a usar con “buscar objetivo” y estuvo muy bueno.
encontré estos ejercicios con macros:

  • Control de Almacén y Kardex
  • Cálculo de Precios
  • Ventas y Facturación
  • Traer fotos cambiantes con macros y con formulas

Mi pregunta, es para que sirven las macros ?

Hola, a pesar de que logré cumplir el reto estoy teniendo un problema. Después de grabar la macro, le soy alt + F11 y no aparece el código de esta última, alguién sabe qué puedo hacer?

La clase más importante, a consideración personal.

Si es que no cuentan con la pestaña de “DESARROLLADOR” o “DEVELOPER” como dejare aquí abajo 😄

Alguien sabe porque me sale esto? 😦
Sub RETO2()

’ RETO2 Macro

'
Application.CutCopyMode = False
Application.CutCopyMode = False
Application.CutCopyMode = False
ActiveCell.Offset(1, 0).Range(“A1”).GoalSeek Goal:=1829, ChangingCell:= _
ActiveCell
End Sub

Reto

Reto cumplido

Sub Macro_Ejercicio2()

’ Macro_Ejercicio2 Macro

'
Application.CutCopyMode = False
Application.CutCopyMode = False
Application.CutCopyMode = False
Range(“C23”).GoalSeek Goal:=1829, ChangingCell:=Range(“C22”)
End Sub

Me gusto demasiado esta clase

Resumen

En esta clase se grabaron Macros para buscar objetivos, asignar a botones y formas con el fin de ejecutarlas de manera amigable, vimos el botón de desplazamiento asignado al cambio numérico en la función objetivo.

Excelente teacher!

No me aparece ni un link para ver la lista de codigos mas frecuentes.

honestamente me parece demasiada informacion, la cual no es tan sencilla como para practicar en dos clases, deberia de estar aparte de este curso.
![](https://static.platzi.com/media/user_upload/image-c7598d37-7532-4857-84b6-25d8c6b42bde.jpg)
![](https://static.platzi.com/media/user_upload/image-a7f55280-3517-4215-abbc-c45b2388a01f.jpg)

Es un tema complejo que se debemanejar en un curso completo

Muy potente juntar las macros con las herramientas aprendidas previamente en este curso.

Excel información.

Que increíble lo que puede hacer excel

Para quienes deseen profundizar un poco más en las macros, en Platzi hay un curso especializado: https://platzi.com/cursos/excel-avanzado-macros/

ok reto superado

Reto Cumplido:

Listo, ya quedo el reto ejemplo2

¡excelente día!

Excelente complemento de herramientas con Macros

no me deja trabajar macros

Excelente clase!

Con este código se evita ver los pantallazos de la ejecución de la macro, se congela la pantalla

Sub Prueba()
Application.ScreenUpdating = False

Secuencias de macro

´´ Para descongelar la pantalla se pone el mismo pero terminado en true

Application.ScreenUpdating = True
End Sub

Reto:

Sub BUSCAR1829()

’ BUSCAR1829 Macro

'
Range(“C23”).GoalSeek Goal:=1829, ChangingCell:=Range(“C22”)
End Sub

Aquí el reto de este curso

En una macro se pueden eliminar valores repetidos pero que sume el valor de los repetidos y solo me agregue un solo valor con el importe de los tres ??

![](

Fue todo un reto hacer el tema de los macros! pero es de gran ayuda.

Modifique el ejercicio, ahora la macro no se limita a buscar solo el valor 1829. En una celda ingreso el valor que quiero calcular y la marco me dice cuanto debo mutiplicar para que el resultado sea valor que ingrese.

Estas son las instrucciones de la macro:
Sub retoMacro()
Range(“C23”).GoalSeek Goal:=1829, ChangingCell:=Range(“C22”)
End Sub

En mi caso, la celda que resta 1829 al valor calculado es la D25.

De modo que mi macro queda así.

Sub RetoBuscarObjetivo()
Range(“D25”).GoalSeek Goal:=0, ChangingCell:=Range(“C22”)
End Sub

Sub Buscar1829()
’ Reto

Range(“C23”).Select
Range(“C23”).GoalSeek Goal:=1829, ChangingCell:=Range(“C22”)

End Sub

Es un tema muy interesante.

La rpta al reto:
Sub MacroReto()

’ MacroReto Macro

'
Range(“D25”).GoalSeek Goal:=0, ChangingCell:=Range(“C22”)
End Sub

https://drive.google.com/drive/recent/macros-grabando-macros_2fb5ff22-9d37-4e27-b0be-f628047ed2e9.xlsm

Esta clase estuvo fascinante 😃

Como puedo hacer para que cambie el valor en tiempo real, mientras muevo el cursor el valor vaya cambiando

Muy buena clase!

Reto cumplido:

reto cumplido:

excelente

Sub Reto1()

’ Reto1 Macro

'
Application.CutCopyMode = False
Application.CutCopyMode = False
Application.CutCopyMode = False
Range(“D23”).GoalSeek Goal:=0, ChangingCell:=Range(“C22”)
End Sub

https://drive.google.com/open?id=1bRGMrlnWuG17iFWU04L-mLlssOPmSHWW

Esta es la forma en como me enseñaron macros en la U, pero la parte de escribir las macros me pareció una cosa super potente (°ロ°)

Buenas Tardes

Comparto ejercicio.

CS

Listo reto cumplido.

Sub BUSCAR_1829()
Range(“C23”).GoalSeek Goal:=1829, ChangingCell:=Range(“C22”)
End Sub

Reto de Macro Grabada

Al final se habla de un link incrustado en la página para revisar los diferentes tipos de códigos. Sin embargo, no encuentro tal link, o acaso se refiere al de la sesión anterior? alguien del público o del staff puede sacarme de la duda?

Excelente clase

![](

Este es el link que mencionan al final del video, igual lo encuentran en los archivos y enlaces de la clase pasada

https://www.gerencie.com/codigos-mas-comunes-de-macros-en-excel.html

Sub RETOMACRO()
’’ RETOMACRO Macro
’ Range(“D25”).GoalSeek Goal:=0, ChangingCell:=Range(“C22”)
End Sub

no entender porque me aparece offset y de color rojo…

Aporte Reto:
Sub buscar1829()

Range(“C23”).GoalSeek Goal:=1829, ChangingCell:=Range(“C22”)
Range(“C23”).Select

End Sub

Sub Buscar1829()

’ Buscar1829 Macro

'
Application.CutCopyMode = False
Application.CutCopyMode = False
Application.CutCopyMode = False
Range(“C23”).GoalSeek Goal:=1829, ChangingCell:=Range(“C22”)
End Sub