+ Reply to Thread
Results 1 to 2 of 2

Excel Autofill Method of Range Class Failed

  1. #1
    Steve
    Guest

    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. #2
    Bernie Deitrick
    Guest

    Re: 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" <Steve@discussions.microsoft.com> wrote in message
    news:524F17C9-4B0B-4B64-BF62-49D5C0AF4A95@microsoft.com...
    > 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1