+ Reply to Thread
Results 1 to 3 of 3

If cell in column contains value, clear contents of another column in the same row

Hybrid View

  1. #1
    Registered User
    Join Date
    08-23-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    2

    If cell in column contains value, clear contents of another column in the same row

    For some reason I'm having a hard time coming up with an easy macro for this, but seems like it should be simple.

    All I want to do is:

    -Check all rows in a spreadsheet
    -If the value of any cell in column C is "False", then delete the contents of column A in the same row

    For example, if C2 is "False", clear the contents of A2...then move down the spreadsheet doing the same thing to all rows (indefinite number of rows)

  2. #2
    Registered User
    Join Date
    08-23-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    2

    Re: If cell in column contains value, clear contents of another column in the same row

    Macro was taking too long to figure out.

    Ended up resorting to a formula entered into D2 and copied down: =IF(C2,A2, " ")

    That created a new column for me where basically if the value of the C cell was false, the cell would be blank, and if true, it contains the value from A2.

    I'll just use that as a workaround for now.

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: If cell in column contains value, clear contents of another column in the same row

    You can use AUTOFILTER for things like this. This should get you there, or close enough for you to finish:

    Option Explicit
    
    Sub FilterOutFALSE()
    Dim LR As Long
    
    With ActiveSheet
        .AutoFilterMode = False
        .Rows(1).AutoFilter 3, "False"
        LR = .Range("A" & .Rows.Count).End(xlUp).Row
        If LR > 1 Then .Range("A2:A" & LR).Value = ""
        .AutoFilterMode = False
    End With
        
    End Sub
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ 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. [SOLVED] Macro To Clear Cell Contents From Top To Bottom Of A Column
    By kany in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-01-2013, 02:16 AM
  2. [SOLVED] Clear cell contents of duplicates within column
    By davegscott in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-12-2012, 06:26 PM
  3. [SOLVED] How to clear cell contents in a certain column based on set criteria
    By macrohelp5 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-25-2012, 10:41 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. Clear Contents of every other cell in one column
    By norolimfrodo in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-06-2011, 12:46 PM

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