ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run macro based on cell value (https://www.excelbanter.com/excel-programming/309934-run-macro-based-cell-value.html)

nowfal[_3_]

Run macro based on cell value
 
Hi,

I wanted to run a macro based on cell value i.e., if i put in C2
number greater than zero it should trigger the macro named 'CUSTOMER'
if it is zero it should not . I am expecting a reply as early a
possible
thanks
nowfa

--
Message posted from http://www.ExcelForum.com


Ron de Bruin

Run macro based on cell value
 
Use this event in the sheet module to do this

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("C2"), Target) Is Nothing Then
If IsNumeric(Target.Value) And Target.Value 0 Then
CUSTOMER
End If
End If
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"nowfal " wrote in message ...
Hi,

I wanted to run a macro based on cell value i.e., if i put in C2 a
number greater than zero it should trigger the macro named 'CUSTOMER',
if it is zero it should not . I am expecting a reply as early as
possible
thanks
nowfal


---
Message posted from http://www.ExcelForum.com/




nowfal[_4_]

Run macro based on cell value
 
Thanks alot Mr. Ron de bruin,
The code is perfectly correct. It works exactly what i wanted. I have
been trying for this for the last one week. Any how thanks once again.
by
nowfal


---
Message posted from http://www.ExcelForum.com/



All times are GMT +1. The time now is 04:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com