Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Event Macro
Can someone please help me with some code please?
I am trying to create a event macro every time the workbook is activated and if data is changed from cells A1 thru A4. I want a macro to check these range of cells and call on another macro when a certain condition is met. In this case I have the following data Column A 95 93 null null I want the macro to look at the most bottom data in the four cells and call on a macro if cell A2 is grater than cell A1. Now in time data will be entered into cell A3, so when when data is present in cell A3 I want the macro to be called if cell A3 is greater than cell A2. I know this is a little confusing, so any help would be awesome. Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Event Macro
Hi Amy
this will help if the data is changed ... Private Sub Worksheet_Change(ByVal Target As Range) If [a3] [a2] Then report = MsgBox("Something else has changed", vbInformation) ElseIf [a2] [a1] Then report = MsgBox("Something's changed", vbInformation) End If End Sub This code to be added to the relevant sheet. Replace the msgbox with the call to your macro. If you need somthing to happen when you activate the sheet, change "Worksheet_Change(ByVal Target As Range)" to "Worksheet_Activate()" "Amy" wrote in message ... Can someone please help me with some code please? I am trying to create a event macro every time the workbook is activated and if data is changed from cells A1 thru A4. I want a macro to check these range of cells and call on another macro when a certain condition is met. In this case I have the following data Column A 95 93 null null I want the macro to look at the most bottom data in the four cells and call on a macro if cell A2 is grater than cell A1. Now in time data will be entered into cell A3, so when when data is present in cell A3 I want the macro to be called if cell A3 is greater than cell A2. I know this is a little confusing, so any help would be awesome. Thanks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Event Macro
Hi bigwheel,
The macro is activating when any value in any cell is changed. Can it be set up so that only values in the range of cells is changed? Thanks -----Original Message----- Hi Amy this will help if the data is changed ... Private Sub Worksheet_Change(ByVal Target As Range) If [a3] [a2] Then report = MsgBox("Something else has changed", vbInformation) ElseIf [a2] [a1] Then report = MsgBox("Something's changed", vbInformation) End If End Sub This code to be added to the relevant sheet. Replace the msgbox with the call to your macro. If you need somthing to happen when you activate the sheet, change "Worksheet_Change(ByVal Target As Range)" to "Worksheet_Activate()" "Amy" wrote in message ... Can someone please help me with some code please? I am trying to create a event macro every time the workbook is activated and if data is changed from cells A1 thru A4. I want a macro to check these range of cells and call on another macro when a certain condition is met. In this case I have the following data Column A 95 93 null null I want the macro to look at the most bottom data in the four cells and call on a macro if cell A2 is grater than cell A1. Now in time data will be entered into cell A3, so when when data is present in cell A3 I want the macro to be called if cell A3 is greater than cell A2. I know this is a little confusing, so any help would be awesome. Thanks . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Event Macro help | Excel Discussion (Misc queries) | |||
Event Macro running another macro inside | Excel Discussion (Misc queries) | |||
'Event' macro | New Users to Excel | |||
Event macro? | Excel Programming | |||
Event macro | Excel Programming |