+ Reply to Thread
Results 1 to 7 of 7

Add Clear and Loop Function to Macro Code

  1. #1
    Forum Contributor
    Join Date
    08-22-2005
    MS-Off Ver
    Office 365
    Posts
    342

    Add Clear and Loop Function to Macro Code

    Hello Pro's

    This is for excel 2010

    I am looking to either add a clear option and or a loop function to the follow macro code.
    This code is working 100% however I need to add a clear option or a loop function when N/A is selected from the drown options in H

    So as per the code below – When N/A-Must add comment is selected – Column I (same row) is prefilled with N/A - And the user would have entered something in Column J (same row) – Works as it should.
    However there could be an instances when N/A-Must add comment could be changed to either No or Yes.

    What can be added to the code below that if "N/A-Must add comment" is changed to either No or Yes…

    •It will clear the data in Column I and J same row
    •And then follow the rules in code for Yes and No
    Last edited by SVTF; 10-30-2014 at 02:18 PM.

  2. #2
    Forum Contributor
    Join Date
    08-22-2005
    MS-Off Ver
    Office 365
    Posts
    342

    Re: Add Clear and Loop Function to Macro Code

    Here is a test workbook

    Thanks in advance.
    Attached Files Attached Files
    Last edited by SVTF; 10-29-2014 at 06:26 PM.

  3. #3
    Forum Contributor
    Join Date
    08-22-2005
    MS-Off Ver
    Office 365
    Posts
    342

    Re: Add Clear and Loop Function to Macro Code

    I have seen some examples of clear contents VB code - which I think would work.
    Just not sure how to include it in the above code around the N/A part of the code?

    Thoughts? Suggestions?

    It would have to be a targeted clear. Only clear I and J when "NA Must add comment" in H is changed to No or Yes and then follow the rest of code function.

    Need more info?
    Last edited by SVTF; 10-29-2014 at 09:28 PM.

  4. #4
    Forum Contributor
    Join Date
    08-22-2005
    MS-Off Ver
    Office 365
    Posts
    342

    Re: Add Clear and Loop Function to Macro Code

    Any of you excel peeps that are 1000% more versed than I able to help me out with this?

    So just clarify the code currently works as needed but need to modify to include.

    If the "N/A-Must add comment" is changed.... Clear data in Column I & J same row. And then loop back around so that the code works for what ever selection is made....

    Ie.

    NA to No... Clear data in I and J and follow No code.

    NA to Yes... Clear data in I and J and follow Yes cone.

    Or even

    NA is deleted and for some reason re-selected... Clear data in I and J and follow NA code.
    Last edited by SVTF; 10-30-2014 at 08:07 AM.

  5. #5
    Forum Contributor
    Join Date
    08-22-2005
    MS-Off Ver
    Office 365
    Posts
    342

    Re: Add Clear and Loop Function to Macro Code

    Thought I had something. Guess not.
    Last edited by SVTF; 10-30-2014 at 12:13 PM.

  6. #6
    Forum Contributor
    Join Date
    08-22-2005
    MS-Off Ver
    Office 365
    Posts
    342

    Re: Add Clear and Loop Function to Macro Code

    Looks like it might be as easy as adding:

    Please Login or Register  to view this content.
    However I also need to clear column 10 same row ...

    How can I expand the range in the above code?

    Because the above only clears Column I

  7. #7
    Forum Contributor
    Join Date
    08-22-2005
    MS-Off Ver
    Office 365
    Posts
    342

    Re: Add Clear and Loop Function to Macro Code

    Solved

    Please Login or Register  to view this content.

+ 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. Replies: 8
    Last Post: 10-11-2014, 09:35 AM
  2. [SOLVED] Loop function to simplify VBA code
    By Faridwahidi in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 05-10-2014, 12:42 AM
  3. Macro, Clear function in a row that has #VALUE!
    By hzppby in forum Excel General
    Replies: 8
    Last Post: 03-20-2012, 01:33 AM
  4. VBA Macro code to clear drop-down menu selection.
    By lealea1982 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-23-2007, 12:05 PM
  5. I keep losing my function when I press a clear button macro!
    By LtsGo4ARide in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-03-2007, 01:56 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