Home |
Search |
Today's Posts |
#1
|
|||
|
|||
VB code. If statement between two values
I have a worksheet where a user input a value. There can be 5 different fomulas based on what value the user enters. How do I make a vb script to say
If the value of sheet1 cell A1 is between 1 and 5, do A1-A2. If the value of sheet1 cell A1 is between 6 and 10, do A1+A2 |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
VB code. If statement between two values
On Sat, 9 Feb 2013 17:22:08 +0000, nappyjim wrote:
I have a worksheet where a user input a value. There can be 5 different fomulas based on what value the user enters. How do I make a vb script to say If the value of sheet1 cell A1 is between 1 and 5, do A1-A2. If the value of sheet1 cell A1 is between 6 and 10, do A1+A2 Take a look at Help for Select Case e.g: Select Case UserInput Case 1 to 5 Result=A1-A2 Case 6 to 10 result = a1+a2 case else result ="Out Of Range" End select |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
IF statement but in code | Excel Programming | |||
VBA code with and / or statement | Excel Programming | |||
Why does this code remove Duplicate Values, by showing only 1, but it does NOT show Unique values for some reason ? | Excel Programming | |||
VBA code for IF statement with OR? | Excel Programming | |||
if statement between values | Excel Worksheet Functions |