Application defined or object defined error

Fernando14

New Member
Joined
Jun 29, 2021
Messages
12
Office Version
  1. 2019
Platform
  1. Windows
I keep getting an application/object defined error for a line of code. I have a loop similar to this one that works fine with the same varaibles. I also reference cells in the same way in other parts of the code without error. Here is the code :
Excel Formula:
    For i = 1 To FLAGNUM
         If FLAGSNORP(i) = "N" Then NORP = "Nylon" Else NORP = "Poly"
         Worksheets("OUTPUTS").Cells(11, cellnum) = NORP & " flag " & i & " area= " & (FLAGSW(i) * FLAGSL(i)) & " sq.ft. "
        cellnum = cellnum + 2
    Next i
The error is in Worksheets.... line. I think the issue lies within the cell reference, but I don't understand why I am getting this error. Any help is appreciated.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
What's the initial value of variable cellnum on entry of this For-Next part?
 
Upvote 0
Solution
You are welcome. Glad it's sorted.
 
Upvote 0

Forum statistics

Threads
1,225,738
Messages
6,186,728
Members
453,368
Latest member
positivemind

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