Results 1 to 8 of 8

Shorten IF/ElseIF statement when making Items visible/not visible

Threaded View

  1. #1
    Forum Contributor
    Join Date
    08-16-2012
    Location
    Sefton
    MS-Off Ver
    MS Office 365 ProPlus
    Posts
    133

    Shorten IF/ElseIF statement when making Items visible/not visible

    Is there a way to shorten a code similar to the below? (i know it's not a complete code - it's an example) It just keeps going until they're all TRUE and then ends with an Else which has them all set to FALSE.

    ValueX is determined elsewhere
    Values A,B,C etc will be in increments of 1

    If 'ValueX' = 'ValueA' Then
       Frame1.Visible = True
       Frame2.Visible = False
       Frame3.Visible = False
       Frame4.Visible = False
       Frame5.Visible = False
       Else If 'ValueX' = 'ValueB' Then
          Frame1.Visible = True
          Frame2.Visible = True
          Frame3.Visible = False
          Frame4.Visible = False
          Frame5.Visible = False
          Else If 'ValueX' = 'ValueC' Then
             Frame1.Visible = True
             Frame2.Visible = True
             Frame3.Visible = True
             Frame4.Visible = False
             Frame5.Visible = False
    etc
    
    End If
    I'm new to code (learning as I go) so if you could explain the different parts of your code it would be very helpful.
    Last edited by DHFE; 11-05-2015 at 08:24 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Select visible range and add page break after every 20th visible cell
    By tuc47285 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-04-2015, 01:18 AM
  2. [SOLVED] Making checkboxes not visible
    By Elizabethd1012 in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 05-01-2014, 02:27 PM
  3. Replies: 4
    Last Post: 01-06-2014, 02:14 AM
  4. Table Object after filtering - Count visible rows & First visible row
    By limalf in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-13-2013, 07:29 PM
  5. Making Formulas Visible
    By thorgal67 in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 12-15-2010, 11:40 AM
  6. Visible frames based on combobox
    By rajeev.raj in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-29-2010, 07:57 AM
  7. Resize Visible Rows based only on Visible Columns text
    By Zimbo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-22-2009, 10:55 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