+ Reply to Thread
Results 1 to 20 of 20

Macro to delete formulas extended past data set

  1. #1
    Forum Contributor
    Join Date
    06-13-2012
    Location
    ND
    MS-Off Ver
    Excel 2010
    Posts
    152

    Macro to delete formulas extended past data set

    How can I clear all the formulas after the last row of data. I have formulas in column k, l, and r.
    Attached Files Attached Files

  2. #2
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Macro to delete formulas extended past data set

    Question - do you want to convert the value that is currently there? and there by not have a formula in that cell. OR, literally remove the formula, which would remove the value also?
    Ernest

    Please consider adding a * if I helped

    Nothing drives me crazy - I'm always close enough to walk....

  3. #3
    Forum Contributor
    Join Date
    06-13-2012
    Location
    ND
    MS-Off Ver
    Excel 2010
    Posts
    152

    Re: Macro to delete formulas extended past data set

    remove formula

  4. #4
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Macro to delete formulas extended past data set

    I didn't see any formulas in column R but at the last row of data in l, I held shift+ctrl+down arrow which selected all the cells after and then I pressed delete.
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  5. #5
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to delete formulas extended past data set

    Please Login or Register  to view this content.

  6. #6
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Macro to delete formulas extended past data set

    so in the case of your data set you want to clear the formulas past row 1821....correct? and only in columns K,L,R...correct?

  7. #7
    Forum Contributor
    Join Date
    06-13-2012
    Location
    ND
    MS-Off Ver
    Excel 2010
    Posts
    152

    Re: Macro to delete formulas extended past data set

    The previous code cleared everything in K, L, and R. I want to clear it after the last record. Not necessarily row 1821 because the number of rows will vary.

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to delete formulas extended past data set

    I was going to correct my code, but your data have crashed my Laptop 3 times.

  9. #9
    Forum Contributor
    Join Date
    06-13-2012
    Location
    ND
    MS-Off Ver
    Excel 2010
    Posts
    152

    Re: Macro to delete formulas extended past data set

    It is a large file because of the formulas, which is why I want to try and get all those formulas out. Attached is a smaller file.
    Attached Files Attached Files

  10. #10
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to delete formulas extended past data set

    The last row in column K is 263, so do you want to clear cells after this row?

  11. #11
    Forum Contributor
    Join Date
    06-13-2012
    Location
    ND
    MS-Off Ver
    Excel 2010
    Posts
    152

    Re: Macro to delete formulas extended past data set

    I want it to be deleted after the last row of data in column B. So row 165. But the row number will be various of where the last record is.

  12. #12
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to delete formulas extended past data set

    Please Login or Register  to view this content.

  13. #13
    Forum Contributor
    Join Date
    06-13-2012
    Location
    ND
    MS-Off Ver
    Excel 2010
    Posts
    152

    Re: Macro to delete formulas extended past data set

    I get an complie error: syntax error. It is highlighting End (ClearContents End)

  14. #14
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to delete formulas extended past data set

    Well,
    On the sample, I did not get any error.

  15. #15
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to delete formulas extended past data set

    This also work

    Please Login or Register  to view this content.

  16. #16
    Forum Contributor
    Join Date
    06-13-2012
    Location
    ND
    MS-Off Ver
    Excel 2010
    Posts
    152

    Re: Macro to delete formulas extended past data set

    It looks like it is working, but it is very slow. I can see why your computer crashed. At one time I tried to copy and paste values for the sheet and that crashed too.

  17. #17
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to delete formulas extended past data set

    You might have data downloaded from an applications, like SAP or Oracle.

  18. #18
    Forum Contributor
    Join Date
    06-13-2012
    Location
    ND
    MS-Off Ver
    Excel 2010
    Posts
    152

    Re: Macro to delete formulas extended past data set

    It is data from SAP Netweaver.

  19. #19
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to delete formulas extended past data set

    You see I guessed correctly. I had answered a question on this thread where the data were exported from SAP and had crashed my PC.

    Going forward, I suggest you should do the following:
    When you copy data from non excel application, you should convert the data in to VALUES ONLY before you use the data.

    Import in to excel, copy and paste values only and then you can do what ever you like in excel. If you just imported in excel, start working on the data, you will experience problems in the future.

  20. #20
    Forum Contributor
    Join Date
    06-13-2012
    Location
    ND
    MS-Off Ver
    Excel 2010
    Posts
    152

    Re: Macro to delete formulas extended past data set

    thank you

+ 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