+ Reply to Thread
Results 1 to 6 of 6

delete only cell values (not formulas) in multiple sheets

  1. #1
    Registered User
    Join Date
    09-25-2009
    Location
    Romania
    MS-Off Ver
    Excel 2003
    Posts
    51

    delete only cell values (not formulas) in multiple sheets

    Hello,

    I am trying to make a button that will re-initialize the workbook: clear (delete) all unlocked cell's values.

    I have the following code:
    Please Login or Register  to view this content.
    This works fine with the cells that are protected, but the problem is that I use formulas on a sheet that has cells which are not protected.

    How can the above code be modified so that will not clear (detele) the formulas, but only the values in cells.

    Thank you
    Last edited by alexandruc; 11-03-2009 at 04:26 AM.

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

    Re: delete only cell values (not formulas) in multiple sheets

    Protect the formula cells
    Hope that helps.

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

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    09-25-2009
    Location
    Romania
    MS-Off Ver
    Excel 2003
    Posts
    51

    Re: delete only cell values (not formulas) in multiple sheets

    Quote Originally Posted by royUK View Post
    Protect the formula cells
    Yes, I know that could be a solution, but I would like to give the users the posibility to manually alter those cells.

    If it's not something that can be done easyly I will eventaully protect the cells.

    Thanks

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

    Re: delete only cell values (not formulas) in multiple sheets

    Why would you want to allow users to alter formulas?

  5. #5
    Registered User
    Join Date
    09-25-2009
    Location
    Romania
    MS-Off Ver
    Excel 2003
    Posts
    51

    Re: delete only cell values (not formulas) in multiple sheets

    Quote Originally Posted by royUK View Post
    Why would you want to allow users to alter formulas?
    The formula brings from another sheet some comments (if they are any).

    I want to give them the option to change those comments on this sheet.

    But now that I think it through (thanks to you), it's not ok, because it will remove the formula and the reinitialization of the workbook will not put the formula back in the cell if the user altered his comment.

    In other words I will protect those cells

    Thanks for the help!


    p.s: it would still be nice to know how to clear cell content without deleteing formula via VB.

  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: delete only cell values (not formulas) in multiple sheets

    You could use one of the SpecialcellTypes to creat a range of non-formula cells. See the VBA Help for more on Specialcells

+ 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