Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming,comp.lang.basic.visual.misc
external usenet poster
 
Posts: 1
Default Autofill method of Range class failed

Hi

I've got a variable called UnPopulated (actually it's longer than that but
I've shortened it to simplify things) which holds the number of the first
blank row in an Excel spreadsheet.

What I'm then trying to do is Autofill a cell from column C of the last
significant row to that blank row (the code selects the cell to AutoFill
from correctly):

Selection.AutoFill Destination:=Range("C" & UnPopulated),
Type:=xlFillDefault

So, if the ActiveCell is C50 then it should AutoFill to C51 but I'm just
getting the error. What is the cure?!

Any help much appreciated.

JJ (UK)


  #2   Report Post  
Posted to microsoft.public.excel.programming,comp.lang.basic.visual.misc
external usenet poster
 
Posts: 11,272
Default Autofill method of Range class failed

Selection.AutoFill Destination:=Range(Selection,cells(UnPopulated,"C" )),
Type:=xlFillDefault

--

HTH

RP
(remove nothere from the email address if mailing direct)


"JJ (UK)" wrote in message
...
Hi

I've got a variable called UnPopulated (actually it's longer than that but
I've shortened it to simplify things) which holds the number of the first
blank row in an Excel spreadsheet.

What I'm then trying to do is Autofill a cell from column C of the last
significant row to that blank row (the code selects the cell to AutoFill
from correctly):

Selection.AutoFill Destination:=Range("C" & UnPopulated),
Type:=xlFillDefault

So, if the ActiveCell is C50 then it should AutoFill to C51 but I'm just
getting the error. What is the cure?!

Any help much appreciated.

JJ (UK)




  #3   Report Post  
Posted to microsoft.public.excel.programming,comp.lang.basic.visual.misc
external usenet poster
 
Posts: 1
Default Autofill method of Range class failed

Bob

Thanks for your reply.

Unfortunately, your idea didn't work, I just get a different error:

Application-defined or object-defined error

:-(

What puzzles me is the original code was taken from a recorded macro which I
then edited....

*...5 minutes later...*

OK, sorted it:

Selection.AutoFill Destination:=Range("C" & Populated - 1 & ":C" &
Populated), Type:=xlFillDefault

Job done!

Thank you for helping me find the way.

JJ (UK)


"Bob Phillips" wrote in message
...
Selection.AutoFill Destination:=Range(Selection,cells(UnPopulated,"C" )),
Type:=xlFillDefault

--

HTH

RP
(remove nothere from the email address if mailing direct)


"JJ (UK)" wrote in message
...
Hi

I've got a variable called UnPopulated (actually it's longer than that
but
I've shortened it to simplify things) which holds the number of the first
blank row in an Excel spreadsheet.

What I'm then trying to do is Autofill a cell from column C of the last
significant row to that blank row (the code selects the cell to AutoFill
from correctly):

Selection.AutoFill Destination:=Range("C" & UnPopulated),
Type:=xlFillDefault

So, if the ActiveCell is C50 then it should AutoFill to C51 but I'm just
getting the error. What is the cure?!

Any help much appreciated.

JJ (UK)






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
Run-time error '1004': AutoFill method of Range class failed murkaboris Excel Discussion (Misc queries) 10 April 16th 09 09:06 PM
Run-time error '1004': AutoFill method of Range class failed murkaboris Excel Discussion (Misc queries) 3 April 14th 09 10:35 PM
Autofill method of range class failed Don Guillett Excel Discussion (Misc queries) 0 February 27th 08 03:56 PM
Autofill method of range class failed Appache Excel Discussion (Misc queries) 5 February 27th 08 03:37 PM
Autofill method of range class failed - sometimes Intellihome Excel Programming 9 May 28th 05 01:21 PM


All times are GMT +1. The time now is 05:19 PM.

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

About Us

"It's about Microsoft Excel"