View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default Application Defined or object defined error

Can't tell from your macro, but if BlockRow is less than 2 then the your
Offset is trying to reference a cell off the top of the worksheet.

Note that you don't need to select anything:

Sheets("Sheet1").Range("C2").Offset(BlockRow - 3, Seed - 1) = BlockSize


In article ,
ExcelMonkey wrote:

I have a macro which is failing on line three of this code:

Sheets("Sheet1").Select
Range("C2").Select
ActiveCell.Offset(BlockRow - 3, Seed - 1) = BlockSize

It Selects the Sheet and the cell but cannot execute the last line.
Blocksize is a variable which is defined as:

?Blocksize
0


The error message is:
Run time Error 1004
Application Defined or object defined error.

What am I doing wrong?

Thanks


---
Message posted from http://www.ExcelForum.com/