Worksheet chnage event

R

Risky Dave

Hi,

I have the following triggered by a worksheet change (there's some other
stuff before this line, but that's all working) which causes an error:

Case Is = "Open"
Range("a" & Target.Row & ":ac" & Target.Row).Select
With Selection.Interior
.ColorIndex = xlNone
End With
Range("o" & Target.Row & ":q," & Target.Row & "t" &
Target.Row_ & ":v," & Target.Row & "z" & Target.Row & ":ab" &
Target.Row).Select
With Selection
.Value = ""
End With
End Select

The error is being generated at the line Range("o" & Target.Row & <etc etc>)
and is "Run-time error 1004: Method 'Range' of object '_Worksheet' failed

Can someone please tell me what tis means and how I fix it?

TIA

Dave
 
R

Risky Dave

For some reason, if I substitute:
Range("O" & Target.Row & ":Q" & Target.Row & ",T" & Target.Row & ":V" &_
Target.Row & ",Z" & Target.Row & ":ab" & Target.Row).Value = ""

This works. Happy to have fixed it but would appreciate an explanation

Dave
 
D

Daryl S

The difference is not in the upper/lower case, but in where the commas are.
If your target.row was 12, the old range would have been
o12:q,12t12:v,12z12:ab12
instead of the new one
o12:q12,t12:v12,z12:ab12
 
R

Risky Dave

Of course!

Thanks

Daryl S said:
The difference is not in the upper/lower case, but in where the commas are.
If your target.row was 12, the old range would have been
o12:q,12t12:v,12z12:ab12
instead of the new one
o12:q12,t12:v12,z12:ab12
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top