Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Member
 
Posts: 70
Default Dynamic Autofill Error

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!
  #2   Report Post  
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.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default Dynamic Autofill Error

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
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Autofill Peter Langdon Excel Discussion (Misc queries) 4 February 12th 09 01:56 PM
Autofill Dynamic Range Fester[_2_] Excel Programming 1 December 8th 08 04:04 PM
autofill with dynamic lists Pontus SWE Excel Programming 1 September 13th 05 06:18 PM
autofill with dynamic range Bernie Deitrick[_2_] Excel Programming 0 September 16th 03 02:55 PM
autofill with dynamic range again a Excel Programming 0 September 16th 03 12:26 PM


All times are GMT +1. The time now is 04:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"