+ Reply to Thread
Results 1 to 5 of 5

Case Statements and Declarations

  1. #1
    Forum Contributor
    Join Date
    04-11-2012
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    245

    Case Statements and Declarations

    I have a User Form with several Multipages. On Multipage 1 the user must select Yes or No from two sets of option buttons and if applicable, check or leave blank two separate checkboxes. How the user fills these fields drives whether or not another set of check boxes resident on a subsequent Multipage (Multipage 5).

    Clicking the “Next” button (Private Sub CommandButton39_Click) at the bottom of Multipage1 is what causes the code to execute. I’m struggling mightily with the case statements and declarations. If anybody can review and comment on the code I have thus far, which now only include three possible scenarios, that would be great.

    Thanks

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor quekbc's Avatar
    Join Date
    01-18-2010
    Location
    Sydney, Australia
    MS-Off Ver
    2010, 2013, 2016
    Posts
    1,149

    Re: Case Statements and Declarations

    Case Is = y = True And Z = True
    That doesn't look right. Perhaps you meant...
    Case y = True And Z = True

    same goes for

    Case Is = y = True And Z = "" And V = ""
    Case Is = y = True And Z = False And V = True

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Case Statements and Declarations

    Q's suggestion, plus

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Valued Forum Contributor quekbc's Avatar
    Join Date
    01-18-2010
    Location
    Sydney, Australia
    MS-Off Ver
    2010, 2013, 2016
    Posts
    1,149

    Re: Case Statements and Declarations

    shg's comment got me thinking... what are you trying to do? The Select Case is usually done to test 1 variable across multiple conditions. For example, this code

    Please Login or Register  to view this content.
    Is the same as...
    Please Login or Register  to view this content.
    Perhaps you'll be better off using the If statement

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

    Re: Case Statements and Declarations

    If you are trying to use Select Case to differentiate between the four possible states of two Option Buttons, you could use something like

    Please Login or Register  to view this content.
    If not, what is Logistics in the OP code?
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

+ 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. Multiple IF statements, or a select case?
    By rob2k77 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-22-2013, 03:31 PM
  2. [SOLVED] Case Statements and If Statements
    By hawsoon13 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 09-05-2012, 12:44 PM
  3. problem with syntax on simple Class declarations and Sub declarations
    By ocean_engineer in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-28-2011, 03:59 AM
  4. help with if then select case statements
    By timermel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-26-2011, 05:35 PM
  5. Multiple case statements
    By abhijit.pendharkar in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-28-2009, 04:12 AM
  6. Case Statements
    By anazarian in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 07-08-2008, 06:11 AM
  7. Select Case Statements
    By ladeda063610 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-06-2008, 11:25 AM
  8. [SOLVED] Declarations Procedure and Duplicate Declarations
    By Neal Zimm in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-30-2005, 08:05 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