+ Reply to Thread
Results 1 to 2 of 2

Macro to Clear Contents of Cells when one cell = 0 %

Hybrid View

  1. #1
    Registered User
    Join Date
    05-10-2013
    Location
    chicago
    MS-Off Ver
    Excel 2010
    Posts
    52

    Macro to Clear Contents of Cells when one cell = 0 %

    I'm trying to create macro that will clear the contents of the cells in the 4 columns to the left of a cell that = 0 %, as well as the cell that = 0%. For example, if cell F13 = 0 % then the contents of B13:F13 would need to be cleared. The range in which data is being pasted into is B13:F27. Any ideas?

  2. #2
    Forum Contributor
    Join Date
    04-25-2013
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2010
    Posts
    150

    Re: Macro to Clear Contents of Cells when one cell = 0 %

    Hi,

    Try this:

    Sub test()
    
    For Each cell In Range("b13:f27")
        If Not cell.Value = 0 Then
        Else
            Range("b" & cell.Row & ":" & cell.Address).Select
            Selection.ClearContents
        End If
    Next
    
    End Sub

+ 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 of ALL cells if a cell contains TRUE
    By burdo77 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-07-2013, 02:00 PM
  2. Macro to clear only the contents of the cells which have a specific font colour
    By Stellakyp in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-05-2013, 11:01 AM
  3. Clear contents of cells when another cell changes value
    By chrisd79 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-13-2013, 05:22 AM
  4. [SOLVED] Macro to clear cell contents in all but 1 column of specified rows
    By HelderPT in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-19-2012, 12:47 PM
  5. [SOLVED] Macro to clear contents of unprotected cells AND drop down boxes
    By JB2010 in forum Excel General
    Replies: 3
    Last Post: 03-30-2006, 05:15 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