Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is it possible to have code on a specific worksheet, say sheet1, which would
run any time the value in cell A4 (and only cell A4) were to change? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You could use the following On Change event. Right click on the sheet tab
name, select view code and past the code into the VBA editor. cCose the editor by clicking on the X in the top right corner of the screen. Unfortunately, if you change like to like (say change 5 to 5) then the code still runs. It does not recognise whether there is a real change in the value; only that you have edited the cell. I don't know of any simple way of saving the old value to test whether there is a real change or only edited with the same value. It is possible to have a copy of the worksheet if this is essential. Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$A$4" Then MsgBox "Address of current cell is " & Target.Address 'Insert the required code in lieu of the msgbox. End If End Sub -- Regards, OssieMac "Patrick C. Simonds" wrote: Is it possible to have code on a specific worksheet, say sheet1, which would run any time the value in cell A4 (and only cell A4) were to change? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is the change in A4 due to a formula in A4?
Private Sub Worksheet_Calculate() On Error GoTo stoppit Application.EnableEvents = False With Me.Range("A4") If .Value < "" Then MsgBox "Please be advised that A1 value changed." End If End With stoppit: Application.EnableEvents = True End Sub Gord Dibben MS Excel MVP On Fri, 22 Feb 2008 21:24:59 -0800, "Patrick C. Simonds" wrote: Is it possible to have code on a specific worksheet, say sheet1, which would run any time the value in cell A4 (and only cell A4) were to change? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Code to change code in a sheet and workbook module | Excel Programming | |||
Change code with code? | Excel Programming | |||
Change code by code. Can you do that? | Excel Programming | |||
Can I use code/macro to change code/macro in an existing file? | Excel Programming | |||
Code Conflicts With Worksheet Change Code | Excel Programming |