+ Reply to Thread
Results 1 to 5 of 5

How do I increase conditions in a Case argument??

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    How do I increase conditions in a Case argument??

    Morning All,

    I've written this code which selects parts based on 3 variables but realised there's another consideration which requires insertion.
    I need to insert the consideration 'If ComboBox42 says "Conical" also.
    Any ideas how I can do this?

    Thank You



    Private Sub ComboBox17_Change() '
    
        
        Select Case Me.ComboBox10.Value
        
        
        Case "4/100" 
            
                If ComboBox17.Value = "M12" And ComboBox7.Value = "C" Then
                    Me.ComboBox31.Value = "HUBAC001"  
                    Me.ComboBox32.Value = "BRNGA001"  
                    Me.ComboBox33.Value = "NOT REQUIRED" 
                    Me.ComboBox34.Value = "NUTA002" 
                    Me.ComboBox35.Value = "510237"   
                    Me.ComboBox36.Value = "HBCAP004"  
                    Me.ComboBox37.Value = "NUTW001"   
                    
                  
                End If
    
    End Select
    
    End Sub

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: How do I increase conditions in a Case argument??

    If you mean to add that condition to the existing If clause, you need only And it into the line thus

    If ComboBox17.Value = "M12" And ComboBox7.Value = "C" And LCase$(ComboBox42) = "conical" Then
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: How do I increase conditions in a Case argument??

    Ah good man, Its works fine. Just one more thing, in the box which contains Conical there are only two variables: Conical and spherical,

    The userform defaults at Conical and the above code works fine. However, if I change to Spherical and insert the other conditions, and then change to Conical, it doesn't change?

    In other words, the conical/spherical will produce different outcomes which I'll need to switch between. Sorry to be a pain:-/

  4. #4
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: How do I increase conditions in a Case argument??

    Changing combobox42 is not going to trigger a change event for combobox17 unless combobox42 changes combobox 17 as well. You need all the relevant controls (comboboxes 7, 17 and 42) to call a routine to update the other controls. I'd also suggest that a good naming convention would make your code more intelligible and thus more maintainable.

  5. #5
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: How do I increase conditions in a Case argument??

    Ok, thank you for that. I'm unsure at the moment how to tackle the logic, but it works for now. Thanks xlnitwit

+ 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] How to extend my case argument????
    By bralew in forum Excel Programming / VBA / Macros
    Replies: 31
    Last Post: 10-19-2016, 06:41 AM
  2. [SOLVED] How can I edit my case argument?
    By bralew in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-18-2016, 05:48 AM
  3. [SOLVED] How do I add another condition to a case argument?????
    By bralew in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-18-2016, 04:05 AM
  4. IF argument with 2 conditions including TEXT
    By rjng90 in forum Excel General
    Replies: 7
    Last Post: 05-31-2016, 10:13 AM
  5. Macro to increase cell value based on two conditions or return a zero if not met.
    By lans4rd in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-30-2013, 05:19 PM
  6. [SOLVED] Function (array argument, range argument, string argument) vba
    By Witek in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-24-2005, 11:07 AM
  7. UDF - case sensitive argument
    By ed in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-21-2005, 01:06 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