+ Reply to Thread
Results 1 to 14 of 14

Macro to pick up item from list

  1. #1
    Registered User
    Join Date
    11-17-2010
    Location
    India
    MS-Off Ver
    Microsoft Office Excel 2003
    Posts
    83

    Macro to pick up item from list

    Hi Friends,

    I have 14 columns in my excel. In that the first 13 columns i have made validation to list items like Pending,completed,Awaiting approval,Awaiting confirmation.

    For the 14th column i have named it as "Status". In that also i have made validation to list items like Pending, completed,Awaiting approval and Awaiting confirmation.

    Now i need a macro coding so that if i select in any one of the 13 columns as pending then the status column should automaticallly get changed to Pending.

    And if i all the column reads as completed then the status column should automatically change into completed.

    Any one can help on this.

    Thanks in advance.
    Last edited by Saky; 11-18-2010 at 12:27 PM.

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Macro to pick up item from list

    Something along these lines perhaps?
    Please Login or Register  to view this content.

  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: Macro to pick up item from list

    Right-click on the sheet tab and VIEW CODE to put in this sheet-event macro:

    Please Login or Register  to view this content.

    Once you close the vbeditor and save, this will operate in realtime and update the column 14 status anytime you put "pending" in the first 13 columns.



    REMINDER/WARNING: Once you start using sheet-event macros, you may find your UNDO option works less often.
    Last edited by JBeaucaire; 11-17-2010 at 11:57 AM. Reason: Small code correction.
    _________________
    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!)

  4. #4
    Registered User
    Join Date
    11-17-2010
    Location
    India
    MS-Off Ver
    Microsoft Office Excel 2003
    Posts
    83

    Re: Macro to pick up item from list

    Friend if i paste this macro and when i update pending in 1st column syatem popps out a error in the coding line: Application.EnableEvent = False.

    Please advice how can i rectify it.

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

    Re: Macro to pick up item from list

    Corrected above, make that the plural.

  6. #6
    Registered User
    Join Date
    11-17-2010
    Location
    India
    MS-Off Ver
    Microsoft Office Excel 2003
    Posts
    83

    Re: Macro to pick up item from list

    Great!!! It is working fine...to add on If i select all the columns as completed then the 14 th column should change to completed automatically..

    Can you give me coding for it. Thanks for your help!!

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

    Re: Macro to pick up item from list

    StephenR above had the right idea for that.
    Please Login or Register  to view this content.


    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  8. #8
    Registered User
    Join Date
    11-17-2010
    Location
    India
    MS-Off Ver
    Microsoft Office Excel 2003
    Posts
    83

    Re: Macro to pick up item from list

    Friend,

    When i update the first 13 cells to pending then the 14th column is getting changed to pending.
    But if i select all the 13 cells as completed then the 14th column is not getting changed to completed.

    Please help me how to rectify it.

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

    Re: Macro to pick up item from list

    The code is correct.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    11-17-2010
    Location
    India
    MS-Off Ver
    Microsoft Office Excel 2003
    Posts
    83

    Re: Macro to pick up item from list

    Friend, In the attached excel u have not added validation to the column N. Hence it is working fine as per the code.

    But in my excel i have made validation in column N as well. It has list of items like Pending, Completed,No action, Mail sent etc..

    So if i select completed in all the first 13 cells, then the 14th column should change to completed. Can you help.

    Sorry for troubling you...Kindly help..

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

    Re: Macro to pick up item from list

    My file does exactly what you've asked. The code does not need nor care if you've also put data validation in column N, it's not using data validation, it's writing "Pending" and "Completed" directly into the cell.

    The code is correct. If you're having difficulty in your sheet, then post it.

  12. #12
    Registered User
    Join Date
    11-17-2010
    Location
    India
    MS-Off Ver
    Microsoft Office Excel 2003
    Posts
    83

    Re: Macro to pick up item from list

    Quote Originally Posted by JBeaucaire View Post
    My file does exactly what you've asked. The code does not need nor care if you've also put data validation in column N, it's not using data validation, it's writing "Pending" and "Completed" directly into the cell.

    The code is correct. If you're having difficulty in your sheet, then post it.
    In my attached excel, i am using the columns from J to W. In column W i need the result..

    I checked many times but it doesnt work..Kindly advice my mistake.

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

    Re: Macro to pick up item from list

    It's not working because you changed the code to use the COUNTIF() = 22 instead of COUNTIF() = 13 like I had it originally. There are only 13 columns from J:W, not 22, so the total still needs to be13 to trigger the "completed" action.

    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    11-17-2010
    Location
    India
    MS-Off Ver
    Microsoft Office Excel 2003
    Posts
    83

    Re: Macro to pick up item from list

    Excellent!!!Thanks for guiding me very patiently.

    You are a star...Thank you soooo much!!!!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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