vba - Output/Print variable, in code, in if statement -
i trying achieve following: user shown excel spread sheet list of assumption can change.
title | value | input01 | 10 | = input02 | 2 | >= input03 | 800 | >= input04 | 4 | >= input05 | 2 | <=
there if .. then
statement pulls in data if assumption met. if assumption blanc, should not included in if .. then
statement.
if x = input01value , y >= input02value _ , z >= input03value , >= input04value _ , b <= input05value
user ommits input03
if x = input01value , y >= input02value _ , >= input04value , b <= input05value
now check see if each value exist, , follow if
statement appropriate variables. seems bit redundant.
i wondering if following possible:
input 01 = "" if input01value != "" input01 = "x = " & input01value 'then use join or similar join of them ..
and use input01
directly in if .. then
statement. way when variable empty and ..
not included , if
statement not fail.
eg. (i know doesn't work, illustrating scenario)
vba: if input01 result while compiling: if x = input01value
please note, know following:
if boolean , variable2 > 4 then
, have boolean
, variable2
populate value in cell, issue if user, example, decides omit variable2
(which reasonable) fail. eg. if (boolean = true) , > 4 then
.
hope question clear, help.
what using function operates on select case depending on string operator , 2 values?
function conditionalstring(condition string, x variant, y variant) boolean select case condition case "=" if (x = y) conditionalstring = true else conditionalstring = false end if exit function case ">=" conditionalstring = (x >= y) exit function case "<=" conditionalstring = (x <= y) exit function case ">" conditionalstring = (x > y) exit function case "<" conditionalstring = (x < y) exit function case else conditionalstring = false end select end function
you have function, "check if value isn't blank" before calling assumptions.
Comments
Post a Comment