D,

Ok, I will tiptoe in here with a couple of questions...
What is \"\" supposed to mean or do? (it won't compile)
Do you get a message, if you change your error handler as follows
and then run your code?
'----------
getout:
Beep
MsgBox "Error " & Err.Number & " " & Err.Description
End Sub
'------------

Jim Cone
San Francisco, USA


"Dolemite"
<Dolemite.1u1aij_1124492743.1147@excelforum-nospam.com>
wrote in message
news:Dolemite.1u1aij_1124492743.1147@excelforum-nospam.com

I cannot figure out why the following code won't execute...this is my
code (without the long equations)...now i am not an expert...this was
developed using bits and pieces that I found while searching through
these forums...
the part that I am looking at right now is the section starting with
"if unit = "" then"
I am using this to delete adjacent cells to the target cell when the
target cell is deleted. But it is only doing the first two lines after
the if statement. I don't know why, I am guessing it has something to
do with the range(target.address) changing, but I am not for sure.
This is the first time that I have really gotten into programming in VB
and I am not quite sure how some of these things behave. Could someone
please help!?

public inmacro as boolean

private sub worksheet_change(byval target as range)
on error goto getout
if inmacro then inmacro = false: exit sub
inmacro = true
if target.column = 3 and target.row <= 1000 then
set unit = range(target.address)
'first part takes care of items deleted, if a unit is deleted then
it deletes the rest of the row
if unit = \"\" then
unit.offset(0, -1) = \"\"
unit.offset(0, 1) = \"\" '**********this is the where it stops
w/o an error
unit.offset(0, 2) = \"\"
unit.offset(0, 3) = \"\"
else
if unit.offset(0, -1) = \"\" then
unit.offset(0, -1) = 1
if left(unit, 1) = worksheets(\"remove price\").cells(2, 4)
then 'unit is a remove unit, so strip off \"i\" and look up the unit
unit.offset(0, 1) = \"long equation\"
else 'if unit doesn't have the i then it is assumed to be a
install unit
if left(unit, 1) = worksheets(\"install price\").cells(2,
4) then 'install unit is preceeded with \"n\"
unit.offset(0, 1) = \"long equation2\"
else 'if unit doesn't have an i or an n, then assumed to be
an install unit
unit.offset(0, 1) = \"long equation3\"

end if
end if
end if
end if
end if

getout:
end
end sub
--
Dolemite