Error 1004 when setting range value

R

Ricky Patel

I keep getting that Error 1004: Application-defined or object-defined
error, when it gets to line:
--->Range("res_REVIEWBY").Value = "love"

WHYYYY?
-----------------------------------------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)


'On Error Resume Next
On Error GoTo ErrHandler
Dim myDoc As Worksheet
Set myDoc = ActiveSheet

If (Target.Cells.Row >= 5 And Target.Cells.Row <= 6) And
Target.Cells.Column = 3 Then
Range("res_REVIEWBY").Value = "love"
Range("res_SIGNBY").Value = "love"
Range("res_APPROVEBY").Value = "nut"
End If

ErrHandler:
MsgBox (Err & Err.Description)

End Sub
 
D

Dave Peterson

Since this code is in a worksheet module, excel assumes the unqualified ranges
(range("res_revewby")) belong to the worksheet that owns the code.

If you fully qualify the ranges, then maybe it'll work ok:

worksheets("othersheetname").Range("res_REVIEWBY").Value = "love"

Another problem would be if that range name didn't exist. Have you verified
that?
 
Top