+ Reply to Thread
Results 1 to 3 of 3

Autofill method of Range class failed

  1. #1
    JJ \(UK\)
    Guest

    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. #2
    Bob Phillips
    Guest

    Re: 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)" <[email protected]> wrote in message
    news:[email protected]...
    > 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. #3
    JJ \(UK\)
    Guest

    Re: 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" <[email protected]> wrote in message
    news:%[email protected]...
    > Selection.AutoFill Destination:=Range(Selection,cells(UnPopulated,"C")),
    > Type:=xlFillDefault
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "JJ (UK)" <[email protected]> wrote in message
    > news:[email protected]...
    >> 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 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