Error 1004 when setting range value

  • Thread starter Thread starter Ricky Patel
  • Start date Start date
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
 
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?
 

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

Back
Top