We can approach the "on change" check by create a function that we will place in a cell. This function will perform an action each time the worksheet change. For exemple if we want to check if the cell B1 get a value we can do this type of function that we will place in a spreadsheet cell : function onChangeCell()
{
if(activesheet() -> range('B1') -> value != "" || activesheet() -> range('B1') -> value <> ""){
activesheet() -> range('A5') -> value = rand(0,100);
}
}
After this we can place on the cell A1 this function like this "=ONCHANGECELL()" then we juste change the content of B1 and see that in the cell A5 the value change.
BUT there is ONE CASE that cause a problem. Imagine we put the value 6 on the cell B1 and after we put again 6 on the cell B1 the action will perform twice, a proper "onchange" function would not allow to perform the second action because the value doesn't change at all(it's 6 and 6). So, to fix this we have to get a proper version of an onchange cell or worksheet. I think we can imagine a function like __open or __before_open, something like this : function __change_worksheet(){
//write your code here
}
and another version could be :
function __change_cell(cell_address){
//write your code here
}
the cell_address could be a string like the method "range".
The onchange function could bring a more user friendly report and bring fresh new system like alert when something wrong in a form or many mechanics like this.
We can approach the "on change" check by create a function that we will place in a cell. This function will perform an action each time the worksheet change. For exemple if we want to check if the cell B1 get a value we can do this type of function that we will place in a spreadsheet cell :
function onChangeCell()
{
if(activesheet() -> range('B1') -> value != "" || activesheet() -> range('B1') -> value <> ""){
activesheet() -> range('A5') -> value = rand(0,100);
}
}
After this we can place on the cell A1 this function like this "=ONCHANGECELL()" then we juste change the content of B1 and see that in the cell A5 the value change.
BUT there is ONE CASE that cause a problem. Imagine we put the value 6 on the cell B1 and after we put again 6 on the cell B1 the action will perform twice, a proper "onchange" function would not allow to perform the second action because the value doesn't change at all(it's 6 and 6). So, to fix this we have to get a proper version of an onchange cell or worksheet. I think we can imagine a function like __open or __before_open, something like this :
function __change_worksheet(){
//write your code here
}
and another version could be :
function __change_cell(cell_address){
//write your code here
}
the cell_address could be a string like the method "range".
The onchange function could bring a more user friendly report and bring fresh new system like alert when something wrong in a form or many mechanics like this.
ok, thanks
Hello Chris,
this would be helpful when you want to implement a value check, but not "olap-server-side" (what would require SVS)
Hi. This is an good idea. Can you please provide some specific examples on where OnCellChange would help?