if else statement to select values from workbook

Posted on 2013-12-28
Medium Priority
Last Modified: 2013-12-28
folks I have a function which activates a select from a specific workbook

Function Select Region()

' Activating GenericUser sheet

however I would like to change the sheet to be used based on the region as specified in sheet 1 i.e.

if sheet1 b1 = europe then


else if sheet1 b1 = asia then


else if sheet1 b1 = africa then


how do i correctly program this?
Question by:rutgermons
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 71

Expert Comment

ID: 39743589
Sub Select_Region()
  select [Sheet1!B1]
    case "europe": rg = "Region1"
    case "asia": rg = "Region2"
    case "africa": rg = "Region3"
    case else: rg = "Region4"
  End select
End Sub

Open in new window

LVL 13

Accepted Solution

Ashok earned 2000 total points
ID: 39743604
Function Select_Region()
   If Sheet1.Range("B1") = "europe" Then
   ElseIf Sheet1.Range("B1") = "asia" Then
   ElseIf Sheet1.Range("B1") = "africa" Then
   End If
End Function

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question