Q:

Adding Cell Value to an Integer (Excel-VBA)

With years of programming experience (beginner with VBA, however), online references, and search engines I'm yet frustrated to the utmost with my inability to get this to work.
I've spent at least two hours trying every combination of CInt, .Range, With/End With, .Value, Cells, etc. that I could possibly think of and it just keeps failing on the "sum = sum + ..." line:
Public Sub Fill_InnerData()

    Dim GNumber As Range
    Set GNumber = Range("GenerateNumber")

    Dim Data As Range
    Set Data = Range("DATA_INNER")

    For r = 1 To Data.Rows.Count

        For c = 1 To Data.Columns.Count
    
            If Data.Cells(r, c) = "" Then
            
                If c > r Then
            
                    Data.Cells(r, c) = 0
            
                Else
                    Dim x As Integer
                    x = r - c + 1
                
                    Dim y As Integer
                    y = 2
            
                    Dim sum As Integer
                    sum = 1
                
                    For i = 1 To c
                        sum = sum + CInt(Worksheets("Data").Range(Cells(x, y)).Value)
                        y = y + 1
                    Next
                
                End If
            
            End If

        Next
    Next

End Sub

By "failing" I mean getting this error:

Run-time error '1004':
Application-defined or object-defined error

I've received that error at the mentioned line with EVERY combination that I tried.
What am I doing wrong?

A:

The think here is with your syntax referring to range. It should be enough to cut it a bit and do it this way:
Sum = Sum + CInt(Worksheets("Data").Cells(x, y).Value)

According to my experiences range requires address string inside parenthesis if only one argument is provided. Or you can put Cells if you provide both starting and ending range points. This two simple lines has correct syntax:
Range(Cells(1,1), Cells(2,2)).Select
Range(Cells(1,1).Address).Select

This is not valid:
Range(Cells(1,1)).Select    'error 1004 here

