ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Application-defined or object-defined error (https://www.excelbanter.com/excel-programming/432378-application-defined-object-defined-error.html)

Bishop

Application-defined or object-defined error
 
I have the following code:

Worksheets("Fail Stats").Cells(FSStartRow, "A") = Cells(i - 5, "A").Value

I keep getting Application-defined or object-defined error. I also tried:

Worksheets("Fail Stats").Cells(FSStartRow, "A") =
Worksheets(center(i)).Cells(i - 5, "A").Value

But that didn't work either. What am I doing wrong?

Jacob Skaria

Application-defined or object-defined error
 
Check out the value of i . If i-5 is less than 1 it will return error

If this post helps click Yes
---------------
Jacob Skaria


"Bishop" wrote:

I have the following code:

Worksheets("Fail Stats").Cells(FSStartRow, "A") = Cells(i - 5, "A").Value

I keep getting Application-defined or object-defined error. I also tried:

Worksheets("Fail Stats").Cells(FSStartRow, "A") =
Worksheets(center(i)).Cells(i - 5, "A").Value

But that didn't work either. What am I doing wrong?


Bishop

Application-defined or object-defined error
 
That was it! I was using the wrong variable... should have been j instead of
i.

Thanks

"Jacob Skaria" wrote:

Check out the value of i . If i-5 is less than 1 it will return error

If this post helps click Yes
---------------
Jacob Skaria


"Bishop" wrote:

I have the following code:

Worksheets("Fail Stats").Cells(FSStartRow, "A") = Cells(i - 5, "A").Value

I keep getting Application-defined or object-defined error. I also tried:

Worksheets("Fail Stats").Cells(FSStartRow, "A") =
Worksheets(center(i)).Cells(i - 5, "A").Value

But that didn't work either. What am I doing wrong?



All times are GMT +1. The time now is 01:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com