Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi
Is it possible to have a macro run when a certain condition is met on a worksheet (or between worksheets). Example: If CellA1 on sheet1 < CellA1 on sheet4 then run the macro "Evaluate" otherwise do nothing Thanks Sandy |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Using event code
Private Sub Worksheet_Change(ByVal Target As Range) Const WS_RANGE As String = "A1" '<== change to suit On Error GoTo ws_exit Application.EnableEvents = False If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then With Target If .Value < "Worksheets("Shete4").Range("A1").Value Then ' do your stuff End If End With End If ws_exit: Application.EnableEvents = True End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Sandy" wrote in message ... Hi Is it possible to have a macro run when a certain condition is met on a worksheet (or between worksheets). Example: If CellA1 on sheet1 < CellA1 on sheet4 then run the macro "Evaluate" otherwise do nothing Thanks Sandy |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
It is possible to do this if the contents on the cells are defined by data
entry rather than calculation. The macro is called an Event Macro. For information see: http://www.cpearson.com/excel/excelM.htm#RunFromCell You can use the calculate event if the cells are defined by calculations, but you need to be careful to avoid infinite loops. -- Gary''s Student - gsnu200716 "Sandy" wrote: Hi Is it possible to have a macro run when a certain condition is met on a worksheet (or between worksheets). Example: If CellA1 on sheet1 < CellA1 on sheet4 then run the macro "Evaluate" otherwise do nothing Thanks Sandy |
#4
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Thank you both - works fine
Sandy "Sandy" wrote in message ... Hi Is it possible to have a macro run when a certain condition is met on a worksheet (or between worksheets). Example: If CellA1 on sheet1 < CellA1 on sheet4 then run the macro "Evaluate" otherwise do nothing Thanks Sandy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
My excel macro recorder no longer shows up when recording macro | Excel Discussion (Misc queries) | |||
My excel macro recorder no longer shows up when recording macro | Excel Discussion (Misc queries) | |||
using a cell value to control a counter inside a macro and displaying macro value | Excel Worksheet Functions | |||
Macro needed to Paste Values and prevent Macro operation | Excel Discussion (Misc queries) | |||
Macro needed to Paste Values and prevent Macro operation | Excel Discussion (Misc queries) |