+ Reply to Thread
Results 1 to 13 of 13

Clear All VBA Codes and formulas

  1. #1
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Clear All VBA Codes and formulas

    Hello

    I have a workbook which contains more than 20 sheets .. I want to get rid of formulas and paste as values
    Also to clear all VBA modules and userforms

    Simply to make the workbook free of everything formulas and modules except the module which will do that task

  2. #2
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Clear All VBA Codes and formulas

    I found that code that clear all userfroms and modules
    Please Login or Register  to view this content.
    But it doesn't remove codes related to workbook or worksheets

  3. #3
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Clear All VBA Codes and formulas

    There's some deletion code on this page http://www.cpearson.com/Excel/vbe.aspx

  4. #4
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Clear All VBA Codes and formulas

    I'm confused of the link you provided sir .. I didn't find my request or I can't deal with them

  5. #5
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Clear All VBA Codes and formulas

    Scroll down the page and you should see a reference to deleting all code.

  6. #6
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Clear All VBA Codes and formulas

    I tried this code
    Please Login or Register  to view this content.
    But I got error (User-defined type not defined)!!

  7. #7
    Forum Contributor
    Join Date
    10-16-2014
    Location
    Center Line, Michigan, United States
    MS-Off Ver
    MS Office 2013
    Posts
    139

    Re: Clear All VBA Codes and formulas

    These were the instructions at the top:

    In order to use the code on this page in your projects, you must change two settings.

    First, you need to set an reference to the VBA Extensibility library. The library contains the definitions of the objects that make up the VBProject. In the VBA editor, go the the Tools menu and choose References. In that dialog, scroll down to and check the entry for Microsoft Visual Basic For Applications Extensibility 5.3. If you do not set this reference, you will receive a User-defined type not defined compiler error.


    Next, you need to enable programmatic access to the VBA Project. In Excel 2003 and earlier, go the Tools menu (in Excel, not in the VBA editor), choose Macros and then the Security item. In that dialog, click on the Trusted Publishers tab and check the Trust access to the Visual Basic Project setting.

    In Excel 2007, click the Developer item on the main Ribbon and then click the Macro Security item in the Code panel. In that dialog, choose Macro Settings and check the Trust access to the VBA project object model.
    Please click the star (add rep) if I helped!

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Clear All VBA Codes and formulas

    Why not just create a PDF?
    Entia non sunt multiplicanda sine necessitate

  9. #9
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Clear All VBA Codes and formulas

    Quote Originally Posted by Loganeb View Post
    These were the instructions at the top:
    Thank you for guiding me I didn't notice that at all
    Thank you very much for this great forum.

    Just the second point to turn all the formulas to just values

  10. #10
    Forum Contributor
    Join Date
    10-16-2014
    Location
    Center Line, Michigan, United States
    MS-Off Ver
    MS Office 2013
    Posts
    139

    Re: Clear All VBA Codes and formulas

    Hey YasserKhalil,

    Here you go. Most efficient code I ever found to do this:

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    06-04-2013
    Location
    Moscow
    MS-Off Ver
    Office 365
    Posts
    100

    Re: Clear All VBA Codes and formulas

    Please Login or Register  to view this content.
    And delete macro without reference to Extensibility 5.3 library:
    Please Login or Register  to view this content.
    Also in Excel 2007 and higher you may save workbook as .xlsx. All macroses will be del
    I'm sorry my english...

  12. #12
    Forum Contributor
    Join Date
    10-16-2014
    Location
    Center Line, Michigan, United States
    MS-Off Ver
    MS Office 2013
    Posts
    139

    Re: Clear All VBA Codes and formulas

    Also, there's a modification to the code to also work on hidden sheets:

    Please Login or Register  to view this content.

  13. #13
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Clear All VBA Codes and formulas

    Quote Originally Posted by The_Prist View Post
    Please Login or Register  to view this content.
    And delete macro without reference to Extensibility 5.3 library:
    Please Login or Register  to view this content.
    Also in Excel 2007 and higher you may save workbook as .xlsx. All macroses will be del
    This is perfect .. Really fantastic Mr. the_prist

+ 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. Transpose Excel formulas to VBA codes
    By kraut in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-29-2013, 11:04 AM
  2. Clear static formulas, but leave linked formulas
    By pacerx in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-26-2013, 05:08 AM
  3. Using Formulas to Generate SKU codes
    By X-tremejoe in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-09-2013, 03:55 PM
  4. Using Formulas to Generate SKU codes
    By X-tremejoe in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-09-2013, 03:33 PM
  5. Creating VBA codes to do what formulas do
    By jacglc2010 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-03-2010, 01:52 PM

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