views:

698

answers:

1

As an exercise, I'm trying to set all the values in the range A1:V35 to "omg".

The following code produces an error:

Sub ktr()

    Dim colIndex As Integer
    Dim rowIndex As Integer
    Dim dataRange As Range

    Set dataRange = Range("A1:V35")

    Cells(1, 1) = dataRange.Columns.Count

    For colIndex = 1 To dataRange.Columns.Count
        For rowIndex = 1 To dataArange.Rows.Count
            Cells(rowIndex, colIndex).Value = "omg"
        Next rowIndex
    Next colIndex

End Sub

The error is:

Run-time error '424':
Object Required

Why is this happening?

+5  A: 

Looks like a typo

For rowIndex = 1 To dataArange.Rows.Count

should be

For rowIndex = 1 To dataRange.Rows.Count
VFB