ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Select Case (https://www.excelbanter.com/excel-programming/315819-re-select-case.html)

susan hayes

Select Case
 
I have the cells below as follows:

Cell B1 = Country
Cell B4 = Amount (denominated in foreign currency)
Cell B5 = Amount (denominated in U.S. Dollars)

Cells D1 through D20 (shows a specific foreign exchange rate for each
country listed in B1)

I wish to use Select Case, instead of the IfElse statements to execute
the following cells as shown example below:

If cell B1 = United Kingdom
then cell B5 = B4 * D1
else leave cell B5 blank.

If cell B1 = Hong Kong
then cell B5 = B4 / D2
else leave cell B5 blank.

I need help to get me started, how would I write the syntax to perform
this example.

For example:
Cell B1 = United Kingdom
Cell B4 = 2000. (GBP)
Cell D1 = 1.45 (exchange rate)
then cell B5 would show the figure $2,900. USD

I specifically don't know the syntax used that makes reference to
specific cells.

Thank you,

Susan


Bob Phillips[_6_]

Select Case
 
Select Case Range("B1").Value
Case "United Kingdom": Range("B5").Value = Range("B4").Value * _

Range("D1").Value
Case "Hong Kong": Range("B5").Value = Range("B4").Value / _

Range("D2").Value
End Select

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Susan Hayes" wrote in message
...
I have the cells below as follows:

Cell B1 = Country
Cell B4 = Amount (denominated in foreign currency)
Cell B5 = Amount (denominated in U.S. Dollars)

Cells D1 through D20 (shows a specific foreign exchange rate for each
country listed in B1)

I wish to use Select Case, instead of the IfElse statements to execute
the following cells as shown example below:

If cell B1 = United Kingdom
then cell B5 = B4 * D1
else leave cell B5 blank.

If cell B1 = Hong Kong
then cell B5 = B4 / D2
else leave cell B5 blank.

I need help to get me started, how would I write the syntax to perform
this example.

For example:
Cell B1 = United Kingdom
Cell B4 = 2000. (GBP)
Cell D1 = 1.45 (exchange rate)
then cell B5 would show the figure $2,900. USD

I specifically don't know the syntax used that makes reference to
specific cells.

Thank you,

Susan





All times are GMT +1. The time now is 09:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com