+ Reply to Thread
Results 1 to 5 of 5

Put Formula in newly inserted cells

  1. #1
    Registered User
    Join Date
    02-19-2013
    Location
    Cebu, Philippines
    MS-Off Ver
    Excel 2010
    Posts
    88

    Put Formula in newly inserted cells

    Hello,

    Please help!

    I'm putting formula in newly inserted cells with no particular cell number. but in the selected cells.

    Example: I added new cells somewhere in column A to H.

    my command as of right now is this,

    Selection.Insert shift:=xlDown
    Selection.FillDown

    It will copy the above formula but will clear the formula in some particular cells.
    the first cell, second cell and third cell will be deleted the formula or .ClearContent

    Thnk you in advance..

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Put Formula in newly inserted cells

    Seems to work OK for me.

    Upload the workbook and describe EXACTLY which cells you are selecting, what you expect to be the result and what result you ACTUALLY get.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    02-19-2013
    Location
    Cebu, Philippines
    MS-Off Ver
    Excel 2010
    Posts
    88

    Re: Put Formula in newly inserted cells

    Sorry for the confusion.

    It will copy the above formula,

    But the problem is, it will also copy the values.

    I need to insert cell with same formula but has no values on it.

    There are no specific cell range because it could be inserted anywhere within column A to Column G only.

    Is it possible if I can insert this cells with below formula?

    the scenario is like this,

    Example:
    I'm going to insert new cells between row 11 and row 12.
    going to select A12:G12
    then Insert new cells with below formula.

    Range("A12").Formula = ""
    Range("B12").Formula = ""
    Range("C12").Formula = ""
    Range("D12").Formula = "=C12"
    Range("E12").Formula = "=F12-C12"
    Range("F12").Formula = "=C12"
    Range("G12").Formula = "=F12/$J$2*$K$2"

    The sheet is protected.
    and using macro, just highlight the cells and click "new lineitem" macro button(Column A-G)

    My problem is, there are no specific range. Depends on where it needs to be inserted.
    Its just cells from Column A to Column G only.

    Thank you for your help. Hope I stated it clearly.

    God Bless.
    Last edited by sunjam; 06-30-2014 at 08:32 AM.

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Put Formula in newly inserted cells

    Hi,

    My general approach for all stuff like this where you want to add a new row with formulae is to keep a master copy of the row with the formulae in place (I generally name this range "NewRecord" and keep it in hidden row 1.

    Then all you need do when adding new cells with the cursor on the row to be inserted

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-19-2013
    Location
    Cebu, Philippines
    MS-Off Ver
    Excel 2010
    Posts
    88

    Re: Put Formula in newly inserted cells

    Now that is a great idea.. You sir are truly a legend in this field..

    Thank you very much..

+ 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. [SOLVED] Macro/VBA to keep formula in newly inserted row
    By Antligen in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-11-2014, 06:32 AM
  2. [SOLVED] Create a Macro to paste formula into newly inserted row
    By simple? in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 08-27-2013, 04:47 PM
  3. [SOLVED] Clear Content of Select Cells in Newly Inserted Rows and Keep Data Validation
    By n_lindsey in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-02-2013, 02:22 AM
  4. Formula to span newly inserted columns?
    By mikep7779 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-10-2010, 09:44 AM
  5. [SOLVED] Naming a newly inserted sheet using VBA
    By Ant in forum Excel General
    Replies: 2
    Last Post: 10-05-2005, 09:05 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