Help with Run-time error '1004': Method 'Range' of object'_Workshe

  • Thread starter Thread starter Ayo
  • Start date Start date
A

Ayo

I know that I did something wrong but I don't know what it is. The error
occurs on the second line of code. Any help will be appreciated.
Thanks.

Set goalWS = Worksheets("AAV Goals Update Tables")
goalWS.Range(Cells(cRow, cCol)) = c1
 
You don't need the Range() function. Cells() already give you the range:

Sub dural()
Dim goalWS As Worksheet
Dim c1 As Integer, cRow As Integer, cCol As Integer
cRow = 1
cCol = 1
c1 = 1
Set goalWS = Worksheets("AAV Goals Update Tables")
goalWS.Cells(cRow, cCol) = c1
End Sub

will work just fine.
 
Back
Top