"Run-time error '1004': Application-defined error'

lYoung

New Member
Joined
Mar 1, 2020
Messages
39
Office Version
  1. 365
Platform
  1. Windows
I'm receiving an error, "Run-time error '1004': Application-defined error' message on this row ' Cells(y, firstCol).Value = WorksheetFunction.Sum(Range(Cells(a - 1, firstCol), Cells(y, firstCol)))'
Do you see my syntax error?

'''''''''''''''''''''''''''''''''''''''''''''''''''''''add 0's to values for the new line inserted
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''add 0 to columns on new line and =sum() to balance row
For i = 3 To lastCol

Cells(y - 1, firstCol).Value = 0
Cells(y, firstCol).Value = WorksheetFunction.Sum(Range(Cells(a - 1, firstCol), Cells(y, firstCol)))
firstCol = firstCol + 1
iterations = iterations + 1

Next i
 
It probably has something to do with one of your variables not being set up properly (you could be doing something like trying to set a Row or Column reference equal to 0).
Can you tell us the value of each and every variable when this error occurs?
 
Upvote 0
Solution
It probably has something to do with one of your variables not being set up properly (you could be doing something like trying to set a Row or Column reference equal to 0).
Can you tell us the value of each and every variable when this error occurs?
Smart man, thank you, found my error and works perfectly
 
Upvote 0
You are welcome.
Glad I was able to help!
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top