Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Using a Input Box Value in an if statement
I'm trying to create an If, then, else statment using the value of an input
box. So lets say the variable of my input box is vdate and it returns 6 how would I write the IF statement to true if vdate = 6. If VDATE = 6 then? What am I missing? Thanks for your help! |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Using a Input Box Value in an if statement
Hi Vick,
try if(vdate=6,"true","false") you just replace the "true" and "false" for you need. hope this help. regards from Brazil Marcelo "Vick" escreveu: I'm trying to create an If, then, else statment using the value of an input box. So lets say the variable of my input box is vdate and it returns 6 how would I write the IF statement to true if vdate = 6. If VDATE = 6 then? What am I missing? Thanks for your help! |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Using a Input Box Value in an if statement
This looks like a formula, I'm looking for this in terms of a macro. Thanks
for the help though. "Marcelo" wrote: Hi Vick, try if(vdate=6,"true","false") you just replace the "true" and "false" for you need. hope this help. regards from Brazil Marcelo "Vick" escreveu: I'm trying to create an If, then, else statment using the value of an input box. So lets say the variable of my input box is vdate and it returns 6 how would I write the IF statement to true if vdate = 6. If VDATE = 6 then? What am I missing? Thanks for your help! |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Using a Input Box Value in an if statement
Vick
There are two types of inputbox (VBA's and Excel's). Excel's is prefixed with Application and has slightly different parameters including what return type in allows. The VBA version returns a string, so if you are checking for an integer, you should explicitly convert it using CInt(). The basic code below works Sub ValueFromInputBox() Dim vDate As String vDate = InputBox("Enter a whole number", "Input") If CInt(vDate) = 6 Then MsgBox "True" Else MsgBox "False" End If End Sub -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England www.nickhodge.co.uk HIS "Vick" wrote in message ... I'm trying to create an If, then, else statment using the value of an input box. So lets say the variable of my input box is vdate and it returns 6 how would I write the IF statement to true if vdate = 6. If VDATE = 6 then? What am I missing? Thanks for your help! |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
Using a Input Box Value in an if statement
sorry, i did not notice that you were looking for a Macro
regards "Vick" escreveu: This looks like a formula, I'm looking for this in terms of a macro. Thanks for the help though. "Marcelo" wrote: Hi Vick, try if(vdate=6,"true","false") you just replace the "true" and "false" for you need. hope this help. regards from Brazil Marcelo "Vick" escreveu: I'm trying to create an If, then, else statment using the value of an input box. So lets say the variable of my input box is vdate and it returns 6 how would I write the IF statement to true if vdate = 6. If VDATE = 6 then? What am I missing? Thanks for your help! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
If statement that does nothing when false | Excel Discussion (Misc queries) | |||
If Statement based on blank fields | Excel Worksheet Functions | |||
input box | Excel Discussion (Misc queries) | |||
Do I need a sumif or sum of a vlookup formula? | Excel Worksheet Functions | |||
Input Form vba help | Excel Discussion (Misc queries) |