+ Reply to Thread
Results 1 to 12 of 12

If cell H10 = "Not Stated" in sheet 1 clear contents D10:F20

  1. #1
    Forum Contributor
    Join Date
    08-08-2012
    Location
    englang
    MS-Off Ver
    Excel 2010
    Posts
    152

    If cell H10 = "Not Stated" in sheet 1 clear contents D10:F20

    Hi guys,

    i'm new to vba but maybe somebody can help me, this is what i would like to achieve:

    if cell H10= "Not Started" clear contents in range D10:F20, but if this cell H10 will contain anything else, do nothing.
    I would like to perform this action without any buttons if possible.

    Thanks in advance
    Last edited by intex; 07-21-2014 at 03:22 PM.

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: If cell H10 = "Not Stated" in sheet 1 clear contents D10:F20

    Put this code in the worksheet module:

    Please Login or Register  to view this content.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Forum Contributor
    Join Date
    06-24-2005
    Location
    excelliot.com
    MS-Off Ver
    2007
    Posts
    325

    Re: If cell H10 = "Not Stated" in sheet 1 clear contents D10:F20

    use this code...

    Please Login or Register  to view this content.
    Cheers!!

  4. #4
    Forum Contributor
    Join Date
    08-08-2012
    Location
    englang
    MS-Off Ver
    Excel 2010
    Posts
    152

    Re: If cell H10 = "Not Stated" in sheet 1 clear contents D10:F20

    Olly,
    maybe i'm doing something wrong, but it does nothing. I have put this code to module, but nothing. Maybe it's because the H10 contains formula?

  5. #5
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: If cell H10 = "Not Stated" in sheet 1 clear contents D10:F20

    Did you put it in the WORKSHEET module?

    (right click worksheet tab, click 'View Code')

  6. #6
    Forum Contributor
    Join Date
    08-08-2012
    Location
    englang
    MS-Off Ver
    Excel 2010
    Posts
    152

    Re: If cell H10 = "Not Stated" in sheet 1 clear contents D10:F20

    excelliot how to activate this macro automatically, because now i have to run it manualy. I would like execute this code every time the words are changing in H10 (the H10 can be "Not Started","Active" or "Completed").

    Also the H10 contains formula
    Thanks

  7. #7
    Forum Contributor
    Join Date
    08-08-2012
    Location
    englang
    MS-Off Ver
    Excel 2010
    Posts
    152

    Re: If cell H10 = "Not Stated" in sheet 1 clear contents D10:F20

    Olly, yes i have put it into Sheet1(Sheet1), and nothing happens when formula changes.
    Also the H10 may contain "Not Started","Active" or "Completed"

  8. #8
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: If cell H10 = "Not Stated" in sheet 1 clear contents D10:F20

    Attach your workbook, please.

  9. #9
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: If cell H10 = "Not Stated" in sheet 1 clear contents D10:F20

    Scrub that - realised what's going on.

    You're not actually changing H10, are you - it's just the value returned by the formula in H10 which is changing...

    So use:
    Please Login or Register  to view this content.
    Again, make sure you put it in the WORKSHEET module.

  10. #10
    Forum Contributor
    Join Date
    08-08-2012
    Location
    englang
    MS-Off Ver
    Excel 2010
    Posts
    152

    Re: If cell H10 = "Not Stated" in sheet 1 clear contents D10:F20

    deleted attachment
    Last edited by intex; 07-21-2014 at 03:25 PM.

  11. #11
    Forum Contributor
    Join Date
    08-08-2012
    Location
    englang
    MS-Off Ver
    Excel 2010
    Posts
    152

    Re: If cell H10 = "Not Stated" in sheet 1 clear contents D10:F20

    Yes, brilliant it works now, you are genius mate!!!

  12. #12
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: If cell H10 = "Not Stated" in sheet 1 clear contents D10:F20

    Excellent, glad we got there! Thanks for the feedback

+ 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] 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
  2. "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
  3. "Clear contents" function for a cell? (SOLVED)
    By farzyness in forum Excel General
    Replies: 3
    Last Post: 08-10-2010, 03:00 PM
  4. Conditional "clear contents" of cells
    By jman0707 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 10-12-2008, 09:09 PM
  5. Clear Contents of "Blank" Rows
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-24-2008, 12:56 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