+ Reply to Thread
Results 1 to 9 of 9

Problem with macro that inserts a row, and copies formulas but not the values.

  1. #1
    Valued Forum Contributor
    Join Date
    02-04-2009
    Location
    Texas
    MS-Off Ver
    Excel 2016
    Posts
    667

    Problem with macro that inserts a row, and copies formulas but not the values.

    I found this macro through the forum (thanks)
    it inserts a row or rows, then copies the formulas from the row above - but is then supposed to delete all of the values (but not formulas)
    for example: I enter the date (A1) my expected revenue (B1) then formulas calculated the next cells.
    I want the macro to create row B with B1 & B2 empty but the formulas in B3...
    Here is the macro.
    Please Login or Register  to view this content.
    It works great - but the values are copied. Did I miss something?


    Thanks for the help.

  2. #2
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: Problem with macro that inserts a row, and copies formulas but not the values.

    Please Login or Register  to view this content.
    When I have this kind of problem I do this to find what went wrong.
    Please Login or Register  to view this content.
    Then look in the Immediate window to make sure I'm working on the right range.
    Foxguy

    Remember to mark your questions [Solved] and rate the answer(s)
    Forum Rules are Here

  3. #3
    Valued Forum Contributor
    Join Date
    02-04-2009
    Location
    Texas
    MS-Off Ver
    Excel 2016
    Posts
    667

    Re: Problem with macro that inserts a row, and copies formulas but not the values.

    I added the line - but did not see any new info (Debug.Print Selection.Address)
    Don't get an error - it just does not go back and delet the constants.

    Maybe I'm not looking in the right place?

  4. #4
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: Problem with macro that inserts a row, and copies formulas but not the values.

    Hi CRIMEDOG;

    I just discovered this thread in my subscriptions. Sorry for not answering earlier.

    Don't know if you're still looking for an answer.
    The thread isn't marked "Solved", but I don't want to waste your time if you're satisfied.

  5. #5
    Valued Forum Contributor
    Join Date
    02-04-2009
    Location
    Texas
    MS-Off Ver
    Excel 2016
    Posts
    667

    Re: Problem with macro that inserts a row, and copies formulas but not the values.

    No I did not get it working - would love some help - would you like me to attach the file?
    Mike

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Problem with macro that inserts a row, and copies formulas but not the values.

    Can't see the point with Excel 2007 Tables
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  7. #7
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: Problem with macro that inserts a row, and copies formulas but not the values.

    Quote Originally Posted by CRIMEDOG View Post
    would you like me to attach the file?
    Mike
    Yes, the macro works exactly like I expected it to. So there must be something in your file that's different.

  8. #8
    Valued Forum Contributor
    Join Date
    02-04-2009
    Location
    Texas
    MS-Off Ver
    Excel 2016
    Posts
    667

    Re: Problem with macro that inserts a row, and copies formulas but not the values.

    Here is the sample file - If you add rows between the filled in rows - it copies the values down (I just want it to copy the formulas)

    Thanks for all the help!
    Attached Files Attached Files

  9. #9
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: Problem with macro that inserts a row, and copies formulas but not the values.

    Hi CRIMEDOG;
    Unfortunately, the macro is working fine. I inserted a row at Row 6 and also Row 28 and it worked fine.

    When you insert a row, select every cell in the new row that you don't want there, and you should see an "=" at the front of the contents. IOW it is a formula and the macro doesn't clear it.

    Specifically
    1) when I was on Row 6 and inserted 1 row, these are the cells that it cleared: A7,J7,AJ7:AK7
    2) when I was on Row 28 and inserted 1 row, these are the cells that it cleared: J29:L29,N29,S29:V29
    If they were not cleared on your computer, I would guess that you changed something before copying it to upload to the forum.

+ 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