hello,
i have been using a lookup code such as
chance = Evaluate("LOOKUP(RAND(),{0,0.5},{""A"",""B""})")
as part of a larger module and it has been working exactly how i expected
i want to modify it a bit so that the "{0,0.5}" part is a changing variable depending on other code
ie:
chance = Evaluate("LOOKUP(RAND(),{0,x},{""A"",""B""})")
however i got an error message when i got to that line of code.
i was wondering if i need to dim x as something in particular for vba to recognize it, i have it as
or maybe there is another issue that im missing
thanks for any thoughts on this one
well i figured out a solution right after i posted!!
Dim x As String, y As Double
y = 0.2
x = "LOOKUP(RAND(), {0," & y & "}, {""A"",""B""})"
chance = Evaluate(x)
seems to work, may not be the best way but it works
Bookmarks