+ Reply to Thread
Results 1 to 7 of 7

Autofill formula to last cell

Hybrid View

q-tip Autofill formula to last cell 09-07-2008, 04:32 PM
VBA Noob q-tip, Please use a more... 09-07-2008, 04:37 PM
shg Or select B1 and just... 09-07-2008, 05:15 PM
q-tip Autofill n rows where n is... 09-10-2008, 05:01 PM
shg Either of these, I reckon: ... 09-10-2008, 05:09 PM
q-tip this doesn't work. any other... 09-10-2008, 05:35 PM
shg Soory, correction posted.... 09-11-2008, 12:59 AM
  1. #1
    Registered User
    Join Date
    09-07-2008
    Location
    Norway
    Posts
    27

    Autofill formula to last cell

    I'm analyzing very large time series in my model. To make my model tidier and to minimize the size of the file, I need a macro to automatically fill out the formulas I need.

    The input data is in the first column, and all kinds of formulas follow to the right. How can I make a macro that will autofill the formulas all the way down to the last input of the data series?

    Say, that I have a data series of ten observations, then the macro will autofill the formula cells 9 rows down, and if I then add 5 observations I can run the macro again and it will autofill 14 rows down from the first row.

    It would be awesome to get some help with this.

    Thanks

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    q-tip,

    Please use a more descriptive title next time

    Maybe

    Sub FillFormula()
    Dim LastRow As Long
    LastRow = Cells(Rows.Count, "A").End(xlUp).Row
    
        Range("B1").AutoFill Destination:=Range("B1:B" & LastRow)
    End Sub
    VBA Noob
    Last edited by VBA Noob; 09-07-2008 at 04:53 PM.
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    Or select B1 and just double-click the fill handle.

  4. #4
    Registered User
    Join Date
    09-07-2008
    Location
    Norway
    Posts
    27

    Autofill n rows where n is given by a cell

    I want to autofill the formula in cell "B10" down "A8" rows. How should I do this?

    Thanks

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    Either of these, I reckon:
        Range("B10").AutoFill Destination:=Range("B10").Resize(Range("A8").Value + 1)
        Range("B10").Resize(Range("A8").Value + 1).Formula = Range("B10").Formula
    Last edited by shg; 09-11-2008 at 01:01 AM. Reason: corrected

  6. #6
    Registered User
    Join Date
    09-07-2008
    Location
    Norway
    Posts
    27
    this doesn't work. any other ideas?

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    Soory, correction posted. Please try again.
    Last edited by shg; 09-11-2008 at 01:01 AM.

+ 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. Multisheet formula autofill while skipping rows
    By SimTurner in forum Excel General
    Replies: 6
    Last Post: 09-29-2012, 08:03 PM
  2. Indirect Formula to return Text from one sheet to cell in another sheet
    By lou031205 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-04-2007, 02:51 PM
  3. value in cell to determine which named range used in formula
    By trashnation in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-31-2007, 04:20 AM
  4. using cell content to reference a worksheet tab name in second workbook
    By Conor in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-29-2007, 09:32 AM
  5. Referencing the formula from a cell
    By JChandler22 in forum Excel General
    Replies: 4
    Last Post: 07-11-2007, 10:02 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