+ Reply to Thread
Results 1 to 2 of 2

if cell contents are equal to "no" then delete contents in other cell

  1. #1
    Registered User
    Join Date
    09-19-2017
    Location
    Vermont
    MS-Off Ver
    2017
    Posts
    1

    Question if cell contents are equal to "no" then delete contents in other cell

    I am working in macros trying to do the following:

    In a table with two columns "Status" and "Value"
    If the Status column has a "no" I want to delete the contents in the value column.

    this is what i have so far, but it does not appear to be working:

    Dim cell As Range
    For Each cell In Range("Table1[[#Headers],[Status]]")
    If cell.Value = "no" Then
    Range("Table1[[#Headers],[Value]]").Select.ClearContents
    End If
    Next cell

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

    Re: if cell contents are equal to "no" then delete contents in other cell

    Use the Offset property to offset n columns from the "no" cell to the cell you want to clear.

    This offsets one column to the left of the 'No' cell.

    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.

+ 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. VBA Updates Pivot Table by cell contents, i want to show "blank" instead of "all"
    By mattinwpg in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-15-2017, 10:58 PM
  2. Replies: 4
    Last Post: 06-11-2017, 02:03 PM
  3. [SOLVED] Delete Rows if a cell does not equal "Finished" or "Complete"
    By Justair07 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 09-27-2013, 12:40 PM
  4. "Form and macro" to delete "Active" cell contents.
    By wanty in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-22-2013, 11:33 PM
  5. if one cell has "X" textin contents, then pull cell "Y"...
    By azazel in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-30-2012, 10:03 AM
  6. Contents in cell not "spilling" into adjacent blank cell
    By bluegrassstateworker in forum Excel General
    Replies: 1
    Last Post: 08-14-2006, 02:35 PM
  7. How do I make a cell's contents equal to another cell's contents with macro program?
    By mgmcdevitt in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-15-2005, 04:44 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