+ Reply to Thread
Results 1 to 9 of 9

VB Code to clear contents

  1. #1
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    VB Code to clear contents

    Hello:

    Need VB Code for below:

    I have a range of cell content to be clear (Value only) but no formula in those cell.

    The range is populated in cell H106.
    Example cell
    if cell H106 = D5:E102 then clear the value value only in cell range D5:E102
    if cell C106 = G5:H102 then clear the value value only in cell range G5:H102.

    Let me Know if you have any questions.
    Thanks.



    Riz

    .

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: VB Code to clear contents

    Try this...

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB Code to clear contents

    Hello:

    Its clearing the formulas in the cell also.
    I want to make sure NOT to erase the formula.
    Let me Know if you have any questions.
    Thanks.



    Riz

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: VB Code to clear contents

    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB Code to clear contents

    Hello:

    It is still easing the formula for some reason.
    Let me Know if you have any questions.
    Thanks.



    Riz

  6. #6
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: VB Code to clear contents

    The last code should work (not clear formulas). I don't know what to tell you.

  7. #7
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB Code to clear contents

    Hello AlphaGrog:

    Please refer to attached sheet, i have made a sample with similar formula.
    Your code is in the module.
    Please have a look and Let me Know if you have any questions.
    Thanks.



    Riz
    Attached Files Attached Files

  8. #8
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: VB Code to clear contents

    Hi rizmomin,

    So you have a cell with a formula in it. Let's say it is something like in C1 the formula is =A1 + B1.

    You want to have the value in C1 not show the answer but keep the formula. This isn't how Excel works. If you put a formula in a cell it shows the answer.

    Perhaps you want to show a white font on a white background for those cells. You aren't really clearing them, you are simply displaying the answers in white.
    (I don't recommend this white on white hack!)

    You are asking for something that Excel doesn't do, and shouldn't do.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  9. #9
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,528

    Re: VB Code to clear contents

    Please Login or Register  to view this content.

+ 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. Clear contents at start of code
    By Ravenous in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-25-2013, 08:39 PM
  2. vba code to clear contents of cell
    By codesRus in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-16-2012, 12:16 PM
  3. Code to clear multiple contents
    By ABSTRAKTUS in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-24-2012, 02:13 PM
  4. Clear Contents Code not working
    By ChemistB in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-15-2009, 04:02 PM
  5. Pop up activated on clear contents code
    By reggie1000 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-20-2009, 07:19 AM

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