+ Reply to Thread
Results 1 to 6 of 6

How do I clear contents from a range excluding formulas and text?

  1. #1
    Registered User
    Join Date
    07-10-2012
    Location
    Norge
    MS-Off Ver
    Excel 2010
    Posts
    10

    How do I clear contents from a range excluding formulas and text?

    Hi!
    I have a range where some cells contain formulas, i want the cells with constants cleared and leave the formulas.
    I thought i coul use SpecialCells, but there may be empty cells in my range, so i get error code 1004 cells not found.
    Any idea how i can solve this?
    Thanks

    Example range:

    January
    Formula
    Formula
    100%
    70%
    80%
    Empty cell
    Empty cell
    100%
    80%
    Formula
    90%
    100%
    80%
    EmptyCell

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437

    Re: How do I clear contents from a range excluding formulas and text?

    I used the following without error.

    Please Login or Register  to view this content.
    Maybe you can post an example workbook and the code you are using.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    07-10-2012
    Location
    Norge
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: How do I clear contents from a range excluding formulas and text?

    Hi!
    Thanks for quick response!
    I get the runtime error using this when one of my ranges contains all blanks, use "On error resume next", and it worked, even though i dont like using On Error.

    Some of the cells I want cleared contains equal sign f.ex: =0,1
    How do I clear these as well?
    code i'm using:

    Please Login or Register  to view this content.

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437

    Re: How do I clear contents from a range excluding formulas and text?

    If ALL the cells are blank then yes you would get that error.

    Nothing wrong with using the error trapping like that.

    unless the cell is formatted a Text then =1,0 is a formula.

  5. #5
    Registered User
    Join Date
    07-10-2012
    Location
    Norge
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: How do I clear contents from a range excluding formulas and text?

    Thank you again for the help! I'll adapt my workbook then and a strict note in the "How to" userguide that those cells should only contain constants!
    Thanks again!

  6. #6
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: How do I clear contents from a range excluding formulas and text?

    @ Normezo

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    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