+ Reply to Thread
Results 1 to 3 of 3

Selection.AutoFill error

  1. #1
    Registered User
    Join Date
    11-03-2006
    Location
    Birmingham, UK
    Posts
    18

    Exclamation Selection.AutoFill error

    Hi ppz,

    i'm trying to use 2 cell references to form a range selection to autofill in a formula.
    The 2 cells are simply the 1st data cell & last data cell in a column. I want to enter a formula in the 1st cell & have a bit of VBA autofill the rest of the column. I created a macro to see the code when i manually do this. It creates a code usiong the Selection.Autofill command being used. When i try to use this with my code i get an error. Error i get states 'Autofill Method Of Range Class Failed'.
    I'm not sure what i'm doing wrong but my code is below:

    TO_WORKSHEET is the worksheet i am using
    strFormula is the formula string created
    strFormulaRangeValue is the range to select for the autofill of the formula
    intLastRowCount is a count of the last row with data in it.


    Please Login or Register  to view this content.
    Please could you help with this issue? If you know of a better method of using VBA to autofill in columns then please let me know.

    Thanks,

    Shuja

  2. #2
    Registered User
    Join Date
    11-03-2006
    Location
    Birmingham, UK
    Posts
    18

    Exclamation

    Just to clarify, this code is run from a module and not the worksheet itself.
    Not sure if this makes a difference.

    regards,

    Shuja

  3. #3
    Registered User
    Join Date
    11-03-2006
    Location
    Birmingham, UK
    Posts
    18
    Figured it out:

    The activecell.offset command value was forcing the range to move down a row so the original formula cell wasn't included in the range for the autofill & so was causing an error.

    Regards,

    Shuja

+ 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