View Single Post
  #2   Report Post  
KeriM KeriM is offline
Member
 
Posts: 70
Default

Quote:
Originally Posted by KeriM View Post
I have a piece of code that does a dynamic autofill and it usually works wonderfully. I just added it to a report that I'm working on, and I got the 1004 runtime error, "Application defined or object-defined error".

Here is my code:

Code:
    NumberofRows = Cells(Rows.Count, "B").End(xlUp).Row  'Choose column letter that has last row of data
    Range("A2").Select
    ActiveCell.Autofill Range(ActiveCell, Cells(NumberofRows, _
    ActiveCell.Column - 1).Offset(, 1))
The NumberofRows variable equates out to 516. I'm not sure if that's a factor in this error (too many rows?).

Any help is appreciated!
Sorry guys, I feel like I'm always answering my own questions before anyone can answer. I took out " - 1).Offset(, 1))" and it worked just fine. Do I even need these in there for this code to work properly? I'm not sure what their purpose is, I pieced this code together from forum posts, so I just copied what worked.