I've created a range object by setting it from another range object's Rows(). When I reference the newly created range by row and column, it generates error 1004.
I can reference the original range by row and column. I've included checks to make sure the rng object points to the same range as the dataset object. When I inspect the rng object, the Value2 shows a single row of data.
Below is the minimum code I'm using that generates the error.
Private Sub TestRangeObject()
Dim i As Long
Dim dataset As Range
Dim rng As Range
Set dataset = sRoster.Range("B18:E37")
For i = 1 To dataset.Rows.Count
Set rng = dataset.Rows(i)
Debug.Print "Rng is Range Obj: " & (TypeOf rng Is Range)
Debug.Print "Same worksheet: " & (rng.Parent.CodeName = dataset.Parent.CodeName)
Debug.Print "Same address: " & (dataset.Rows(i).Address = rng.Address)
'can reference dataset object by row and column
Debug.Print "First column (dataset): " & dataset(i, 1).Address
'error when referencing rng object by row and column
Debug.Print "First column (rng): " & rng(1, 1).Address
Next i
End Sub