+ Reply to Thread
Results 1 to 5 of 5

VBA if cell value(s) in range ="1/0/1900" clear contents

  1. #1
    Registered User
    Join Date
    05-28-2015
    Location
    Seattle, WA
    MS-Off Ver
    Office 2010
    Posts
    4

    VBA if cell value(s) in range ="1/0/1900" clear contents

    Hello there,
    I have tried a few different options for this and have not been able to find what I need. What I am looking for is a macro to check a range for a value and, if found, clear cell contents. One of the examples I have tried is below:

    Please Login or Register  to view this content.
    I have tried various other similar codes, but with no success.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: VBA if cell value(s) in range ="1/0/1900" clear contents

    Please Login or Register  to view this content.
    or

    Please Login or Register  to view this content.
    Last edited by shg; 06-08-2015 at 07:27 PM.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: VBA if cell value(s) in range ="1/0/1900" clear contents

    There are a number of things wrong. The code does not define a range to look at so it doesn't know which cells to look in to delete the 1/0/1900. The "SheetName" should be that actual name of the sheet, default is Sheet1, Sheet2 and so on. Try this...
    Please Login or Register  to view this content.
    This will select all the cells in range A1:G8 then run through and delete any cell that contains 1/0/1900

    Edit* Use SHG's code, it's much cleaner and will serve your purpose better than mine will.
    Last edited by gmr4evr1; 06-08-2015 at 07:27 PM. Reason: added Edit
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  4. #4
    Registered User
    Join Date
    05-28-2015
    Location
    Seattle, WA
    MS-Off Ver
    Office 2010
    Posts
    4

    Re: VBA if cell value(s) in range ="1/0/1900" clear contents

    Perfect! Thank you.

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: VBA if cell value(s) in range ="1/0/1900" clear contents

    You're welcome.

+ 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. Addition to Not clear contents based on if "NA" is in cell
    By bdouglas1011 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-17-2014, 01:35 PM
  2. [SOLVED] If cell H10 = "Not Stated" in sheet 1 clear contents D10:F20
    By intex in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-21-2014, 03:23 PM
  3. [SOLVED] Loop to Clear Contents if Value is Null ""
    By ExcelQuestFL in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-19-2013, 05:56 PM
  4. "Clear contents" function for a cell? (SOLVED)
    By farzyness in forum Excel General
    Replies: 3
    Last Post: 08-10-2010, 03:00 PM
  5. Conditional "clear contents" of cells
    By jman0707 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 10-12-2008, 09:09 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