Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default Excel Autofill Method of Range Class Failed

Trying to Use the Code below to autofill a selection. Error comes up when
executed, code is in a loop in which i is the number of the row.

Set sourceRange = Worksheets("Ref. PGW").Range(Sheets("Ref. PGW").Cells(i -
1, 8), Sheets("Ref. PGW").Cells(i - 1, 10))
Set fillRange = Worksheets("Ref. PGW").Range(Sheets("Ref.
PGW").Cells(i, 8), Sheets("Ref. PGW").Cells(i, 10))
sourceRange.AutoFill Destination:=fillRange, Type:=xlFillDefault

Thanks, Steve
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Excel Autofill Method of Range Class Failed

Steve,

The autofiill method requires that the Destination Range includes the source range.

But, you could use

SourceRange.Copy FillRange

or

SourceRange.Copy SourceRange.Offset(1,0)

or

sourceRange.AutoFill Destination:=Range(sourceRange,fillRange), Type:=xlFillDefault

HTH,
Bernie
MS Excel MVP


"Steve" wrote in message
...
Trying to Use the Code below to autofill a selection. Error comes up when
executed, code is in a loop in which i is the number of the row.

Set sourceRange = Worksheets("Ref. PGW").Range(Sheets("Ref. PGW").Cells(i -
1, 8), Sheets("Ref. PGW").Cells(i - 1, 10))
Set fillRange = Worksheets("Ref. PGW").Range(Sheets("Ref.
PGW").Cells(i, 8), Sheets("Ref. PGW").Cells(i, 10))
sourceRange.AutoFill Destination:=fillRange, Type:=xlFillDefault

Thanks, Steve



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
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 phil2006[_16_] Excel Programming 2 June 28th 06 12:08 PM
Autofill method of Range class failed JJ \(UK\)[_2_] Excel Programming 2 August 14th 05 07:46 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 11:09 PM.

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"