+ Reply to Thread
Results 1 to 3 of 3

How to Auto Fill base on a dynamic range

  1. #1
    Forum Contributor
    Join Date
    05-04-2013
    Location
    USA
    MS-Off Ver
    Excel 365
    Posts
    184

    How to Auto Fill base on a dynamic range

    Hi,

    I would like to auto fill my data based on a dynamic range. I have a variable name
    row_count, which counts the number of rows to be filled. If row_count is
    equal to 45, it will fill down to 45 rows. Can someone explain to me why this
    code doesn't work?

    Doesn't work:

    Range("A2:G2").Select ' Select A2 to G2

    Selection.AutoFill Destination:=Range("A2G & row_count)") ' with the selection fill to from A2 to G45


    Work:


    Range("A2:G2").Select ' Select A2 to G2

    Selection.AutoFill Destination:=Range("A2:G45") ' with the selection fill to from A2 to G45

    Thank you for you help

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: How to Auto Fill base on a dynamic range

    change your code to
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    05-04-2013
    Location
    USA
    MS-Off Ver
    Excel 365
    Posts
    184

    Re: How to Auto Fill base on a dynamic range

    Thank you!

+ 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. data auto fill base on condition.
    By johncena in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-20-2013, 04:30 PM
  2. Dynamic Auto-Fill Range based upon Specific number of rows
    By a333 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-02-2013, 03:54 AM
  3. Auto fill from data base drop down list
    By ciapul12 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-03-2011, 08:45 AM
  4. [SOLVED] Can you Auto fill address in excell with a data base?
    By bayou beot in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-12-2005, 05:06 AM
  5. Auto fill dynamic range based on month
    By [nordis] in forum Excel General
    Replies: 0
    Last Post: 01-14-2005, 08:53 AM

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