+ Reply to Thread
Results 1 to 7 of 7

Deleting Cells, but not ones with formulars

  1. #1
    Registered User
    Join Date
    06-17-2005
    Posts
    11

    Deleting Cells, but not ones with formulars

    Hello,

    I have a large sheet that people enter data into each week. I want to be able to hightlight a large area of the sheet and delete the data in those selected cells, but not the formulars that are in some of the cells.

    Anyone know how I can do this?

    Any help apreciated!

    S
    Last edited by scriblesvurt; 06-17-2005 at 04:13 AM. Reason: subscribe

  2. #2
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    This worked for me:

    Sub DeleteCells()

    Set rng = Range("A1:B2")

    For Each cl In rng
    MsgBox cl.Formula
    If cl.Formula = True Then
    cl.ClearContents
    End If
    Next


    End Sub


    Put the code in a standard module and run.


    Mangesh

  3. #3
    Registered User
    Join Date
    06-17-2005
    Posts
    11
    Hi,

    This works apart from It puts up an OK box that you have to click for each cell. This is a lot of clicking to clear 200+ cells. Any way to change it so that it just runs right through?

    Thanks,

    S

  4. #4
    Registered User
    Join Date
    06-17-2005
    Posts
    11
    Got it,

    I just removed

    MsgBox cl.Formula

    Thanks for this!

    S

  5. #5
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    Sorry, forgot to remove the Msgbox statement.

    Mangesh

  6. #6
    Dave Peterson
    Guest

    Re: Deleting Cells, but not ones with formulars

    Another way.

    Select your cells to clean up.
    Edit|goto|Special
    click Constants
    click ok
    hit the delete key on the keyboard.

    Don't select any cells that have labels you want to keep
    (headers/instructions/etc).

    scriblesvurt wrote:
    >
    > Hello,
    >
    > I have a large sheet that people enter data into each week. I want to
    > be able to hightlight a large area of the sheet and delete the data in
    > those selected cells, but not the formulars that are in some of the
    > cells.
    >
    > Anyone know how I can do this?
    >
    > Any help apreciated!
    >
    > S
    >
    > --
    > scriblesvurt
    > ------------------------------------------------------------------------
    > scriblesvurt's Profile: http://www.excelforum.com/member.php...o&userid=24399
    > View this thread: http://www.excelforum.com/showthread...hreadid=380010


    --

    Dave Peterson

  7. #7
    Registered User
    Join Date
    06-17-2005
    Posts
    11
    Thats great. Thanks!!

+ 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