+ Reply to Thread
Results 1 to 10 of 10

Autofill Variable Range

  1. #1
    Registered User
    Join Date
    08-20-2014
    Location
    Toronto, Canada
    MS-Off Ver
    2013
    Posts
    95

    Autofill Variable Range

    I'm trying to get a variable range to autofill.

    More detail:

    I'll be working with files that have a variable amount of rows & columns. I'm trying to reach the first column with no text in it and enter text in the first cell. In the second cell I'd like to add a formula and autofill it down to the last row.

    Here's what I have so far:

    Please Login or Register  to view this content.
    The last command (the bit with autofill) is where I'm struggling.

    Suggestions?

  2. #2
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Autofill Variable Range

    Hi,

    Try this code :

    Please Login or Register  to view this content.
    1. I care dog
    2. I am a loop maniac
    3. Forum rules link : Click here
    3.33. Don't forget to mark the thread as solved, this is important

  3. #3
    Registered User
    Join Date
    08-20-2014
    Location
    Toronto, Canada
    MS-Off Ver
    2013
    Posts
    95

    Re: Autofill Variable Range

    I get:

    "Compile Error:

    Wrong number of arguments or invalid property assignment"

    on that last line ("Range" is highlighted).

  4. #4
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Autofill Variable Range

    Please look at my attached file.

    If you have different layout, then please upload your file.
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Autofill Variable Range

    Maybe:

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    08-20-2014
    Location
    Toronto, Canada
    MS-Off Ver
    2013
    Posts
    95

    Re: Autofill Variable Range

    Quote Originally Posted by karedog View Post
    Please look at my attached file.

    If you have different layout, then please upload your file.
    Seems to have worked this time around. Thanks!

  7. #7
    Registered User
    Join Date
    08-20-2014
    Location
    Toronto, Canada
    MS-Off Ver
    2013
    Posts
    95

    Re: Autofill Variable Range

    Quote Originally Posted by JOHN H. DAVIS View Post
    Maybe:

    Please Login or Register  to view this content.
    John, yours worked as well. Thanks. Do you mind explaining the last two lines in the code?

  8. #8
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Autofill Variable Range

    You're welcome.

    Please Login or Register  to view this content.
    used cells as range 1= row, ulc = Last used column in row, offset 1 column = "Vehicle ID"

    Please Login or Register  to view this content.
    Range from (cells row 2, Lastused Column) to cells(ulr - first empty row in Column A, ulc- Last used column) - Places the formula all the way down.

    Hope that helps.

  9. #9
    Registered User
    Join Date
    08-20-2014
    Location
    Toronto, Canada
    MS-Off Ver
    2013
    Posts
    95

    Re: Autofill Variable Range

    Quote Originally Posted by JOHN H. DAVIS View Post
    You're welcome.

    Please Login or Register  to view this content.
    used cells as range 1= row, ulc = Last used column in row, offset 1 column = "Vehicle ID"

    Please Login or Register  to view this content.
    Range from (cells row 2, Lastused Column) to cells(ulr - first empty row in Column A, ulc- Last used column) - Places the formula all the way down.

    Hope that helps.
    Thanks again, John.

  10. #10
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Autofill Variable Range

    Anytime. Glad to help out.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Autofill with a variable range
    By Jbm444 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-23-2010, 04:37 PM
  2. VBA .Range autofill variable column same row
    By Zaeguzah in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 06-04-2010, 07:24 AM
  3. autofill in macro range is constant- how can I code to be a variable range?
    By mcg7@ntrs.com in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-20-2010, 12:44 AM
  4. AutoFill, can the last cell in range be variable?
    By AdamParker in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-02-2008, 04:09 PM
  5. autofill variable range
    By PaulSin in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-29-2006, 08:52 PM

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