+ Reply to Thread
Results 1 to 6 of 6

VB for Auto-Fill

  1. #1
    Forum Contributor
    Join Date
    08-06-2007
    Posts
    105

    VB for Auto-Fill

    Can someone help me tweak this code? It's telling me I need an object?

    I need it to autofill just as if you selected range A1 and A2 and double clicked that little square on the bottom right hand side of the cell (so it stopps auto-filling at the last active cell in B)

    Please Login or Register  to view this content.
    Last edited by adgjqetuo; 06-08-2009 at 04:10 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VB for Auto-Fill

    Maybe this:
    Please Login or Register  to view this content.
    Since the one above overlaps the next section (which is what your original macro seemed to do), this version does NOT do that:
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: VB for Auto-Fill

    You probably need to explain what you mean by last active row in column B. When you use Select, you have changed the active cell. Select is seldom needed.

    Try a manual fill and you will see the limitations of fill. Trying to fill a range that is not legal will result in an error. Comment the line above and uncomment the line below to see this error.
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    08-06-2007
    Posts
    105

    Re: VB for Auto-Fill

    Thanks for the responses!

    JBeaucaire: Yours worked but it just auto-fills down 60,000+ Cells - I need it to stop at the last active cell in column B (Just like if you double clicked that little square)

    Kenneth: I tried your code, and couldn't get it to work.

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VB for Auto-Fill

    Which column can be evaluated (examined) to determine the last row? Column B, for instance? You haven't posted a sheet so we're working blind here.

    In the red line of code here, change the column listed (blue) to point to the column where data exists already and can be used to spot the last row to copy down to:
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    08-06-2007
    Posts
    105

    Re: VB for Auto-Fill

    Works prefect!

    Thanks!

    And yes it was column B it needs to look at - sorry for the confusion!

+ 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