+ Reply to Thread
Results 1 to 11 of 11

Select case on range name

Hybrid View

  1. #1
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Select case on range name

    An example workbook would help. Are they all Named Ranges referring to single cells, if so you need to loop through the Names not the cells

    Maybe
    
    Option Explicit
    Sub VALIDATEINPUT()
        Dim Nm As Name
    
        For Each Nm In Names
            Select Case Nm.Name
    
            Case "EMP": If Range("EMP") = "" Then MsgBox ("You must enter an employee number at the top")
            Case "RES"
                If Range("RES") = "" Then
                    MsgBox ("You must select a reason for the change request")
                ElseIf Range("RES") = "Other - Please specify" Then
                    If Range("RESO") = "" Then
                        MsgBox ("You must enter a reason in the 'other reason' box")
                    End If
                End If
            End If
    'etc
    Last edited by royUK; 01-07-2011 at 01:22 PM.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  2. #2
    Forum Contributor mcinnes01's Avatar
    Join Date
    05-25-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    449

    Re: Select case on range name

    Here is a very basic example of what I am trying to do. Essentially if the various criteria for each cell aren't met then the relevent msgbox should display
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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