Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running a macro based on a value
Is there a way to create an "event based" macro in Excel? I need to have an
input box pop up whenever a cell value greater than 0 is entered. Thanks! -- |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running a macro based on a value
Use the Change event if it will be entered manually
see Chip Pearson's overview of events http://www.cpearson.com/excel/events.htm -- Regards, Tom Ogilvy "Jeanne Conroy" wrote: Is there a way to create an "event based" macro in Excel? I need to have an input box pop up whenever a cell value greater than 0 is entered. Thanks! -- |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running a macro based on a value
the only way i can think of to do this is to have it run from the sheet
code (right click select view code) Private Sub Worksheet_SelectionChange(ByVal Target As Range) If cell(x,y).Value 0 Then macroname End if end sub put that in a loop and that should work. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running a macro based on a value
An appropriately modified version of the following code should do
it...Ron OnEntry Property and Change Event An OnEntry handler runs when the user enters data in a worksheet. You can use the OnEntry property of either the Worksheet or Application object to associate a procedure with the entry of data on any worksheet. The event occurs after the user enters data in a cell and presses ENTER or selects another cell. The event does not occur if the user click Cut or Paste on the Edit menu or if another procedure changes the contents of a cell. For example, the following code associates a procedure that validates the data entered in a cell with the OnEntry event only if the cell is in column B: Sub TrapEntry() Workbooks("GeneData").Worksheet("GeneCountDB").OnE ntry = _ "ValidateColB" End Sub Sub ValidateColB() With ActiveCell If .Column = 2 Then ' Test for second column. If IsNumeric(.Value) Then If .Value < 0 or .Value 255 Then Msgbox "Entry must be between 0 and 255." .Value = "" End If Else ' Handle nonnumeric entry. Msgbox "Entry must be a number between 0 and 255." .Value = "" End If End If End With End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Running a macro based on the time | Excel Discussion (Misc queries) | |||
Finding a value based on a running sum | Excel Worksheet Functions | |||
running total based on text | Excel Discussion (Misc queries) | |||
Running a macro based on a cells value | Excel Programming | |||
Running a query based off values in col A | Excel Programming |