Application-defined or Object-defined Error with Range and Cells

19 Views Asked by At

I'm trying to use VBA to update cells in a sheet "Allocation TEST" in a variable number of columns, found in sheet "Worksheet". The code is saved in Module1.

I'm getting an error at the .Range line. What am I doing wrong?

Sub resetDoors()
Dim TotalDoorsR As Integer
Dim rr As Integer

TotalDoorsR = ThisWorkbook.Sheets("Worksheet").Range("C14").Value

For rr = 0 To TotalDoorsR
    With ThisWorkbook.Sheets("Allocation TEST")
        .Range(.Cells(4, rr * 2), .Cells(18, rr * 2)).Value = "EMPTY"
    End With
    Next

On Error Resume Next

End Sub
0

There are 0 best solutions below