VBA RunTime Error 1004: Method 'Range' of Object'_Worksheet' failed

grf

Board Regular
Joined
Oct 30, 2004
Messages
70
Office Version
  1. 365
Morning experts,

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    With Target
        If .Cells.Count > 1 Then Exit Sub
        If Not Intersect(.Cells, Me.Range("C2:C1199")) Is Nothing Then
        .Offset(0, -1).Value = Date        '''''' or  Now <- Just a note: Now() will include date + time
       End If
   If Not Intersect(.Cells, Me.Range("I2:I1199")) Is Nothing Then

        Target.Offset(0, -6).Copy Destination:=Sheets("INCOME TOTALS").Range("AD4")
        Target.Offset(0, -5).Copy Destination:=Sheets("INCOME TOTALS").Range("AE4")
        Target.Copy Destination:=Sheets("INCOME TOTALS").Range("AF4")
    With Range(Range("AG4").Value)
        .Value = .Value + Range("AF4").Value
  End With
        
End If
End With
End Sub

Run time error stops on With Range(Range("AG4").Value)
AG4 contains the address of a cell that I want the value in AF4 to be added to.
I'd be grateful for any help you could give on how to straighten this out
grf
 
Thank you Mark 858, your knowledge has given me the answer and I fear that if I had provided more information at the beginning then this could have been cleared up sooner. Your suspicions were correct in that there are 2 sheets involved. I've taken the With Range(Range part from the original and placed it in a Change ByVal on the sheet where the additions are made and it works fine. Thanks again for your knowledge and patience.
Regards
grf
 
Upvote 0

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
You're welcome, but you probably could have resolved it quite simply by referencing the other sheet with the range.
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,262
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top