Ask a Question

Object required error on While loop

SOLVED
masalvacion
New Contributor

Object required error on While loop

Hi,

 

I encountered an error stating "Object required" error on the While loop statement.

Kindly see the attached image for reference. I hope you could help me! Thank you in advanced!

 

Code.pngError.png

1 ACCEPTED SOLUTION

Accepted Solutions
CBleunven
Contributor

Re: Object required error on While loop

Hi masalvacion,

at lane 14, when you do

 

var b = Excel.Cells(12,2);

you get a reference on the cell object, not the value of the cell.

Like this, you try to compare an integer with an object that produces the error.

Try

 

var b = Excel.Cells(12,2).Value;

Regards,

Christophe

View solution in original post

2 REPLIES 2
CBleunven
Contributor

Re: Object required error on While loop

Hi masalvacion,

at lane 14, when you do

 

var b = Excel.Cells(12,2);

you get a reference on the cell object, not the value of the cell.

Like this, you try to compare an integer with an object that produces the error.

Try

 

var b = Excel.Cells(12,2).Value;

Regards,

Christophe

View solution in original post

masalvacion
New Contributor

Re: Object required error on While loop

Hi Christophe,

 

Thank you so much! It works! 😄

cancel
Showing results for 
Search instead for 
Did you mean: