+ Reply to Thread
Results 1 to 16 of 16

Auto change title in column 'X'

  1. #1
    Forum Contributor
    Join Date
    12-15-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    672

    Auto change title in column 'X'

    Please suggest me a code to auto change title in column 'x' base on the following condition:

    Column 'c' title is selected 'Mr.' and in column 'u' marital status selected ' Married' then the title in column 'x' should be change to 'Mrs.' automatically.

    Column 'c' title 'Mrs.' is selected and in column 'u' marital status is 'Married' is selected then in column 'x' should be change to 'Mr.'

    column 'c' 'Mr. or Mrs.' is selected and in column 'u' 'Unmarried' is selected then the column 'x' should be change to '-' automatically.

    If '-' is selected in column 'u' then the column 'x' should be change to '-' automatically (no matter what is in column 'c')

    If '-' is selected in column 'c' then the column 'u and x' should be change to '-' automatically.

    Please help me to achieve this target automatically.

    Thanking you in anticipation.

    Mukesh

  2. #2
    Registered User
    Join Date
    10-11-2013
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2002
    Posts
    71

    Re: Auto change title in column 'X'

    Hey, try this

    Please Login or Register  to view this content.

  3. #3
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Auto change title in column 'X'

    Whether this should happen to all cells in the whole columns or for any particular cells only?

    If it is particular cells then provide us the cell references.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  4. #4
    Registered User
    Join Date
    10-11-2013
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2002
    Posts
    71

    Re: Auto change title in column 'X'

    Don't really get what you mean with selected..

  5. #5
    Forum Contributor
    Join Date
    12-15-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    672

    Re: Auto change title in column 'X'

    Hi christopherL,
    Thank you for suggestion. It's giving error 1004. Actually I want to insert the code in sheet module fo automatic action. I apologize for not attaching a sample file for your reference.

    Now I'm attaching a sample file for your reference. Please go through it and give me a solution. There are already few codes for other functions in it. Add this code there.

    Thank you.

    Mukesh
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    10-11-2013
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2002
    Posts
    71

    Re: Auto change title in column 'X'

    Sorry about that,
    This works for me.

    Please Login or Register  to view this content.
    If you are happy with your result please mark the thread "Solved" in thread settings,
    and if you are please with your response please add reputation!

    Regards C

    Quote Originally Posted by mukeshbaviskar View Post
    Hi christopherL,
    Thank you for suggestion. It's giving error 1004. Actually I want to insert the code in sheet module fo automatic action. I apologize for not attaching a sample file for your reference.
    Last edited by christopherL; 10-25-2013 at 07:22 AM.

  7. #7
    Forum Contributor
    Join Date
    12-15-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    672

    Re: Auto change title in column 'X'

    No! I want a code to work automatically after selecting the selection. Please see my file again to correct it as per my requirement.

    Sorry for trouble.

    Thank you.

    Mukesh
    No, I want a code to work automatically. I don't want to do it manually.

    Please see my file again to modify it as per my requirement.

    Sorry for trouble.

    Thank you.

    Mukesh

  8. #8
    Registered User
    Join Date
    10-11-2013
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2002
    Posts
    71

    Re: Auto change title in column 'X'

    You put the macro in the module attached to the workbook (in the VBA editor, doubleclick on ThisWorkbook in the properties window) . Call the macro Workbook_Open(), and it will run whenever the workbook is first opened.

  9. #9
    Forum Contributor
    Join Date
    12-15-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    672

    Re: Auto change title in column 'X'

    No, I don't want to use call event for it because there are already some other macros in this workbook code. I want the output while entering the data because otherwise the user may confuse whether the selection is changed after opening the file or not.

    I want to create case 25 column 'x' for this function.

    Please help me.

    Thank you.

    Mukesh

  10. #10
    Forum Contributor
    Join Date
    12-15-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    672

    Re: Auto change title in column 'X'

    I have inserted the code in sheet module 'case 24' but it is giving error. Please go through it and give me a solution.
    Please see the attachment.

    Thank you.

    Mukesh
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    08-08-2012
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2013
    Posts
    13

    Re: Auto change title in column 'X'

    Hi Mukesh

    How about formula instead of VB. So this formula in X9 and copied down

    =IFERROR(IF(U9="Married",VLOOKUP(C9,{"Mr.","Mrs.";"Mrs.","Mr."},2,0),"-"),"-")

  12. #12
    Forum Contributor
    Join Date
    12-15-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    672

    Re: Auto change title in column 'X'

    Hi alanga,
    Excellent! What a tricky formula. It's working fine.

    Thank you very much for solving my problem.

    Have a nice day.

    Mukesh

  13. #13
    Forum Contributor
    Join Date
    12-15-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    672

    Re: Auto change title in column 'X'

    Hi Alanga,
    Sorry, I need a little modification in the formula as follows:

    If there is nothing selected in column 'c' and column 'u' then the column 'x' should be blank.

    I tried to add ', ""' at the end but it's giving error. Please correct the formula and solve the problem.

    Thank you.

    Mukesh

  14. #14
    Registered User
    Join Date
    08-08-2012
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2013
    Posts
    13

    Re: Auto change title in column 'X'

    post deleted, need to rethink

  15. #15
    Registered User
    Join Date
    08-08-2012
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2013
    Posts
    13

    Re: Auto change title in column 'X'

    So I added in the bit in red. Not very nice but I think it does the trick.

    =IF(COUNTA(C9,U9)=2,IFERROR(IF(U9="Married",VLOOKUP(C9,{"Mr.","Mrs.";"Mrs.","Mr."},2,0),"-"),"-"),"")
    Last edited by alanga; 10-27-2013 at 09:41 AM.

  16. #16
    Forum Contributor
    Join Date
    12-15-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    672

    Re: Auto change title in column 'X'

    Dear Alanga,
    Excellent! It's a very tricky and complicated formula you have created. It solved my problem.

    Congratulation and thank you once again.

    Have a nice day.

    Mukesh

+ 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. Automatically change the title in a column
    By clovelly in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 01-26-2012, 09:52 AM
  2. Replies: 2
    Last Post: 03-16-2009, 06:55 PM
  3. Auto change column to Title Case
    By Zyphon in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-08-2008, 11:18 AM
  4. [SOLVED] Named range=Column title,comumn title in cellB6 use B6in equation
    By Graham in forum Excel General
    Replies: 2
    Last Post: 07-21-2006, 05:10 AM
  5. change chart title with auto filter
    By Aja in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 07-16-2005, 01:34 AM

Tags for this Thread

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