Hi. So this is probably an easy one for a lot of you but it's killing me! I've found lots of similar-ish questions but can't get any answers to work :banghead:
SV = InStr(IdStrPart1, intID)
works for my variables. Both terms within InStr are names of variables - in this case they are both the number 5. (If it makes any difference, IdStrPart1 is actually a string and intID is an integer)
I want to make SV a function where I pass it both of the terms (x, intID). The second term is fine but I'm having pblms with the first. The issue I believe is because I'm passing it the string of a name of a variable and it can't cope. I suspect I need eval() or similar, but I'm stuck.
Using the immediate window I have found that:
"InStr(" & x & ", intID)" gives me InStr(IdStrPart1, intID)
and
InStr(IdStrPart1,intID) gives me the answer 1 (which I want )
but,
eval("InStr(" & x & ", intID)") gives me nothing as it "can't find the name IdStrPart1"
What am I missing? (sorry for the rambling question, this has fried my brain!)
SV = InStr(IdStrPart1, intID)
works for my variables. Both terms within InStr are names of variables - in this case they are both the number 5. (If it makes any difference, IdStrPart1 is actually a string and intID is an integer)
I want to make SV a function where I pass it both of the terms (x, intID). The second term is fine but I'm having pblms with the first. The issue I believe is because I'm passing it the string of a name of a variable and it can't cope. I suspect I need eval() or similar, but I'm stuck.
Using the immediate window I have found that:
"InStr(" & x & ", intID)" gives me InStr(IdStrPart1, intID)
and
InStr(IdStrPart1,intID) gives me the answer 1 (which I want )
but,
eval("InStr(" & x & ", intID)") gives me nothing as it "can't find the name IdStrPart1"
What am I missing? (sorry for the rambling question, this has fried my brain!)