+ Reply to Thread
Results 1 to 5 of 5

Coding logic based on several different scenarios

  1. #1
    Registered User
    Join Date
    07-10-2019
    Location
    New York, NY
    MS-Off Ver
    MS Office 2016
    Posts
    31

    Coding logic based on several different scenarios

    Hello to all the coding superstars out there!

    I have created a Userform with a few different sections enabled or disabled based on questions answered on the previous tab.

    Capture.PNG

    What I'm trying to do is make the "Next" button become enabled if the user has completed all the enabled fields above, while ignoring any disabled fields. The problem I keep coming up against is how to code all the different combinations of options. So like, if section A is enabled and section B,C, and D are not, then the user would only have to complete open fields in section A, however if section A and B are enabled, but C and D are not, then they would need to complete both sections, and so on...

    I started with your basic If/Then statement to account for all the different combinations, but I have to believe there is a better way to deal with this type of coding logic. What do you all think would be the most efficient way to achieve what I'm trying to do?

    Many thanks for your suggestions!
    Last edited by AAnderson4912; 05-12-2024 at 08:37 PM.

  2. #2
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,411

    Re: Coding logic based on several different scenarios

    Use the 'Select Case' statement - structure is more efficient than nested 'if then' loops.
    Torachan,

    Mission statement; Promote the use of Tables, Outlaw the use of 'merged cells' and 'RowSource'.

  3. #3
    Registered User
    Join Date
    07-10-2019
    Location
    New York, NY
    MS-Off Ver
    MS Office 2016
    Posts
    31

    Re: Coding logic based on several different scenarios

    Interesting. I'm not really familiar with "Select Case" statements. Could you elaborate on how it might be used in this instance? Is there any other info that I can provide that would help explain?

  4. #4
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,411

    Re: Coding logic based on several different scenarios

    Far easier to give an in context solution with the app (workbook) uploaded.
    What is triggering the 'Next' condition - is it the page change event or is it transition from frame to frame.?

  5. #5
    Registered User
    Join Date
    07-10-2019
    Location
    New York, NY
    MS-Off Ver
    MS Office 2016
    Posts
    31

    Re: Coding logic based on several different scenarios

    Here's a pared down version of my workbook.

    UserformExampleWB.xlsm

    Thanks again for your help!

+ 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. Values based on different scenarios
    By aueia in forum Excel General
    Replies: 1
    Last Post: 09-07-2023, 07:54 PM
  2. [SOLVED] Calculate % based on 4 scenarios.
    By myobreportguru in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-30-2019, 07:06 AM
  3. Multiple users reading data from Public Folders (Logic rather than coding question)
    By pjwhitfield in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-19-2015, 09:42 AM
  4. sorting multiple columns; need help w/ logic & VBA coding
    By jyl7 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-05-2013, 07:44 PM
  5. [SOLVED] Various scenarios based on selection criteria
    By Harlequin in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-24-2013, 06:56 AM
  6. Excel 2007 : Need formula based on multiple scenarios
    By LAB2007 in forum Excel General
    Replies: 4
    Last Post: 07-08-2010, 04:07 PM
  7. Conditional Format based on 2 scenarios
    By NotaExpert in forum Excel General
    Replies: 1
    Last Post: 08-07-2007, 06:30 PM

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