+ Reply to Thread
Results 1 to 2 of 2

a work around for nested IF?

  1. #1
    Registered User
    Join Date
    12-30-2011
    Location
    Reston, VA
    MS-Off Ver
    Excel 2010
    Posts
    9

    a work around for nested IF?

    I want to have a drop down list of cities that belong to its state.
    So let's say if
    A1 = Virginia, then B1 listbox should list all of the cities of Virginia.
    A1 = California, then B1 listbox should list all of the cities of California.
    and so on...
    There are 50 states; therefore, I don't think I can do a nested if for this. I created a User Defined function as below:
    Function City(State As String) As String
    Select Case State
    Case Is = "Virginia"
    City = VirginiaCities
    Case Is = "California"
    Grades = CaliforniaCities
    End Select
    End Function
    Where ViginiaCities and CaliforniaCities are Named fields.
    My function obviously doesnot work, so I don't know if Named field is allowed in this case? If so, where is wrong in this function?

    I thank you very much for any help (even with different approach, don't have to be a function solution) !
    Valkie
    Last edited by valkie; 01-06-2012 at 04:26 AM.

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: a work around for nested IF?

    Hi Valkie, please take a moment to read the forum rules, and then edit your thread to wrap your code properly using CODE tags.

    Thank you!

+ 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