¿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

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
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
 
Upvote 0
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. :))
 
Upvote 0

Forum statistics

Threads
1,214,421
Messages
6,119,392
Members
448,891
Latest member
tpierce

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
Back
Top