Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Prevent error when deleting row within Worksheet_Change target ran
Good afternoon, all,
I posted this problem earlier, but perhaps didn't explain it too well. I have a database in columns B:D and I use the following event code to change the interior colour of a data row, based on the value entered into column D of that row. (named "ColorIndexCol" - D5:D59) Private Sub Worksheet_Change(ByVal Target As Range) Dim Intersection As Range Set Intersection = Intersect(Target, Range("ColorIndexCol")) If Not Intersection Is Nothing Then If Not Target Is Nothing Then Target.Offset(0, -2).Resize(1, 3).Interior.ColorIndex = Target.Value End If End If End Sub Whilst this works fine, if I delete any row between 5 and 59 i.e. within the "ColorIndexCol" range), I get the error "Aplication defined or object defined error", highlighting the "target.offset... line. As you can see, I've tried to trap the error by using if not target is nothing, but it doesn't work. Does anyone know how I can resolve this, please? Thanks in advance Pete |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Worksheet_change Target Address is Reference Cell | Excel Programming | |||
Worksheet_change Target Address is Reference Cell | Excel Programming | |||
How find if target is object in Worksheet_Change (ByVal Target As.. ?) | Excel Programming | |||
Error with Target.Name.Name in Worksheet_Change event | Excel Programming | |||
Many Sub Worksheet_Change(ByVal Target As Range) In One Worksheet | Excel Programming |