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

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
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,223,894
Messages
6,175,252
Members
452,623
Latest member
Techenthusiast

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