Consulting

Results 1 to 6 of 6

Thread: Autofill NOT COPYING formula

  1. #1
    VBAX Mentor
    Joined
    Jan 2008
    Posts
    384
    Location

    Autofill NOT COPYING formula

    I have a formula at a location on a worksheet.
    When I select that cell, I want to copy that formula across the worksheet for 7 columns, but Autofill is copying the value rather than the formula.

    Any ideas how to stop this and copy only the formula.

    This is the code that I'm using.

    Range("AU65536").End(xlUp).Offset(2, 0).Select  
    Selection.AutoFill Destination:=Range(ActiveCell, ActiveCell.Offset(0, 7)), Type:=xlFillDefault

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,726
    Location
    Works for me

    I was wondering about the

    Range("AU65536").End(xlUp).Offset(2, 0).Select 
     
    since it seems to go up to the first non-blank cell, and then down 2, which seems like it'd be blank

    Maybe post a small workbook
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  3. #3
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,645
    This functions as expected:

    In A1: "=A9+12"

    Sub M_snb()
       Cells(1).AutoFill Cells(1).Resize(, 10)
    End Sub
    In J1 I find: "=J9+12"

  4. #4
    VBAX Mentor
    Joined
    Jan 2008
    Posts
    384
    Location
    Thanks for the responses:
    Paul_Hossler & snb


    Upon closer inspection, the formula in that cell needed to be converted.
    The formula =SUM($AU$2:$AU$15) needed to be =SUM(AU2:AU15) to work as intended.

  5. #5
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,726
    Location
    Don't you hate it when Excel does what you tell it to do, and not what you want it to do?
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  6. #6
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,645
    The development of an emphatic Excel version would be a challenge for AI.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •