Dynamic Autofill Error

K

KeriM

I have a piece of code that does a dynamic autofill and it usually work
wonderfully. I just added it to a report that I'm working on, and I go
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
factor in this error (too many rows?).

Any help is appreciated
 
C

Claus Busch

Hi,

Am Thu, 18 Oct 2012 14:15:10 +0000 schrieb KeriM:
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))

try:
NumberOfRows = Cells(Rows.Count, "B").End(xlUp).Row
Range("A2").AutoFill Range(Cells(2, 1), Cells(NumberOfRows, 1))


Regards
Claus Busch
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top