Worksheet change event and setting target range


Posted by Greg on December 29, 2000 9:37 AM

I have seen this before and I am going crazy trying to remember where. I want to use the worksheet change event to have the macro do something when range b:b is changed. How do I set the range to only b:b so the cells aren't changed if I am in a range other than b:b.

Thanks for the help,

GREG

Posted by cpod on December 29, 2000 10:17 AM

The onChange event returns a range object call "Target" that tells you what range has changed. You have to check against that to decide whether to run your code.

Posted by Greg on December 29, 2000 10:38 AM

I was wondering what the syntax is, I know approximately how it works. I just don't remember how to check the range. All I get is the value of the cell changed.

Posted by Greg on December 29, 2000 10:54 AM


I fingered it out. Thanks for the help.

GREG



Posted by cpod on December 29, 2000 11:00 AM

Well, you want to check whether anything in column B has changed:

If target.column = 2 then
{code}
end if