+ Reply to Thread
Results 1 to 6 of 6

Clear Contents Function

  1. #1
    Registered User
    Join Date
    12-09-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    13

    Question Clear Contents Function

    Hi All,

    Is it possible to create a function that clears the contents of a cell when the criteria is met?

    For instance, if A1>0 then Clear Contents of A1.

    Cheers,
    mem
    Last edited by mem_dawg; 12-19-2011 at 09:37 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: Clear Contents Function

    Please Login or Register  to view this content.
    Worksheet event code is stored on a worksheet module. To add it to your worksheet, do the following:

    Copy the code
    Select the worksheet in which you the code to run
    Right click on the sheet tab and choose View Code, to open the Visual Basic Editor.
    Where the cursor is flashing, choose Edit | Paste
    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
    12-09-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Clear Contents Function

    Thanks Roy,

    that's exactly what I needed.

    cheers,
    mem

  4. #4
    Registered User
    Join Date
    12-09-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    13

    Question Re: Clear Contents Function

    Hey Roy,

    Just a quick question.. I have applied this code to several sheets which are pulling data from a macro running master sheet. Then these sheets are executing some orders automatically, my problem is this Clear Content VBA is not working automatically unless I manually change the figures. Is there any way to sort this?

    cheers,
    mem

  5. #5
    Forum Contributor Toonies's Avatar
    Join Date
    07-30-2009
    Location
    Newcastle, UK
    MS-Off Ver
    Excel 2016
    Posts
    511

    Re: Clear Contents Function

    you could try

    Private Sub Worksheet_Change(ByVal Target As Range)

  6. #6
    Registered User
    Join Date
    12-09-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Clear Contents Function

    that didn't work either.. I think I need something that runs the macro every one or two seconds..

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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