¿Cómo ejecutar una macro automáticamente, cada vez que el resultado de una fórmula en una celda arroje un valor específico?

megamateus7

New Member
Joined
Jun 4, 2021
Messages
1
Office Version
  1. 2019
Platform
  1. Windows
Hola a todos
Soy nuevo en este mundo de las macros.
Agradezco mucho a quien me pueda colaborar con el siguiente caso:

Tengo la siguiente fórmula en la celda A2:
= SI (A1 <10; ""; "Ejemplo")

Quiero que una macro se ejecute automáticamente, de tipo msgbox, cuando el resultado de la fórmula en A2 sea "Ejemplo".

Ahora, entiendo que cada vez que yo haga un cambio en la hoja, se evaluará nuevamente la fórmula y la macro obviamente se activará. También deseo que no pase esto a menos que yo ingrese datos en la celda A1.

les agradezco
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
13,994
Office Version
  1. 2007
Platform
  1. Windows
Could a moderator move the question to Questions in Other Languages. Thanks

Hi @megamateus7 and Welcome to MrExcel.

Put the following macro in the events of your sheet. (Pon la macro en los eventos de tu hoja)

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  If Target.CountLarge > 1 Then Exit Sub
  If Target.Address(0, 0) = "A1" Then
    If Range("A2").Value = "Ejemplo" Then
      MsgBox "Aquí lo que quieras en el mensaje"
    End If
  End If
End Sub
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
51,863
Office Version
  1. 365
Platform
  1. Windows
Could a moderator move the question to Questions in Other Languages. Thanks
Hi Dante
Best to use the Report link at the bottom left of the post in question for requests like this. That way a Moderator will see the request fairly quickly rather than relying on a moderator happening to read the thread. In this case somebody else did report it, which is what brought it to my attention.
(Good to see you back, by the way. :))
 

Forum statistics

Threads
1,148,427
Messages
5,746,618
Members
424,033
Latest member
al1en

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top