+ Reply to Thread
Results 1 to 15 of 15

Command buttomn action based on combobox value

  1. #1
    Registered User
    Join Date
    05-24-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    34

    Command buttomn action based on combobox value

    Hi

    I want to write a code somthing like this:

    HTML Code: 
    But it doesn't work!

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

    Re: Command buttomn action based on combobox value

    Try this, right click on ComboBox3 of UserForm3 and click view code. Place your code (without the Sub CommandButton4_Click)on the line below Private Sub ComboBox3_Change() in the window that comes up. You code now becomes..
    Please Login or Register  to view this content.
    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

  3. #3
    Registered User
    Join Date
    05-24-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Command buttomn action based on combobox value

    Thankx. but CommandButton4 is on userform4.
    I want to click on command button then another userform pops up. is that possible?

  4. #4
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Command buttomn action based on combobox value

    What happened when you tried it?
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  5. #5
    Registered User
    Join Date
    05-24-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    34
    Quote Originally Posted by mikerickson View Post
    What happened when you tried it?
    Nothing happend! My question is: when i select value in combobox3 on userform3
    I'm going to userform4 to fill out the form. Then click on commandbutton4,if there is another value on combobox3, then its userform pops up.

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

    Re: Command buttomn action based on combobox value

    OK, try this instead
    UserForm3 Code
    Please Login or Register  to view this content.
    UserForm4 code
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    05-24-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Command buttomn action based on combobox value

    Thanks it is works but I still have problem. mabye i chose wrong way!

    you see in combobox3 there are 2 values and each value has specefic userform.
    I want to create a commondbutton that, when I am in userform4( for credit option) when click on commondbutton it recogonize that there is another option(Norme in this case) and notice me to going to that userform. in this case userform5.
    But I dont know how can I do that?
    Attached Images Attached Images
    Last edited by aidda; 08-09-2015 at 12:33 PM.

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

    Re: Command buttomn action based on combobox value

    Sorry, I don't understand.

  9. #9
    Registered User
    Join Date
    05-24-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    34
    Quote Originally Posted by gmr4evr1 View Post
    Sorry, I don't understand.
    I'm trying to say what i want in a good way! I'm working on this for more than 2 days!!

    Anyway,I just want commandbutton4 on userform4 check the value of combobox3 on userform3. If it has 1 value do some thing. If it has 2 value do something else

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

    Re: Command buttomn action based on combobox value

    That's what the UserForm4 code I posted in post# 6 was for. When you click on CommandButton4, If ComboBox3 of UserForm3 is Company, then show Done! message, OR if it is Team, then show UserForm5.

  11. #11
    Registered User
    Join Date
    05-24-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    34
    Quote Originally Posted by gmr4evr1 View Post
    That's what the UserForm4 code I posted in post# 6 was for. When you click on CommandButton4, If ComboBox3 of UserForm3 is Company, then show Done! message, OR if it is Team, then show UserForm5.
    Thats right and it is work perfectly. But if i want: if combobox3 has value 1 then check it if it has value 2 or not. In this code it is just check the name. If i want check the index, is that possible?

  12. #12
    Registered User
    Join Date
    05-24-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Command buttomn action based on combobox value

    maybe something like this:

    HTML Code: 
    But this code doesn't work

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

    Re: Command buttomn action based on combobox value

    Check where on the other form? And which form?

  14. #14
    Registered User
    Join Date
    05-24-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Command buttomn action based on combobox value


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

    Re: Command buttomn action based on combobox value

    You need this in UserForm3 for it to work
    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. [SOLVED] Using Command Button to Open Worksheet Based on ComboBox Selection
    By laura_jean in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-10-2014, 09:23 AM
  2. How to run macro based on Combobox and command button?
    By laxminarayana in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-21-2014, 12:29 PM
  3. disciplinary action command button
    By jdasp49 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-20-2012, 11:10 AM
  4. [SOLVED] Error in Executing the Command Button Action
    By Edelweiss in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-21-2012, 07:27 AM
  5. Replies: 2
    Last Post: 01-03-2012, 11:23 AM
  6. Action will Cancel Pending Refresh Command
    By mdk5008 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-13-2009, 12:33 PM
  7. Replies: 1
    Last Post: 09-17-2007, 09:57 PM
  8. Call Action From A Command Bar
    By joe12613 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-12-2007, 11:26 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