Hi All,
I've spent the better part of the day working on this, and it's working great except for 1 small issue (well, it's a large issue to the end result but a small code issue).
What I am doing is comparing the values in column1 of an excel file, then searching column 3 of a second excel file for that value, and if it matches return column 4 of the second file.
The code works great, except it's matching on any appearance of that value, and not the exact value only.
What I mean is that if column1 has a value of "2", I need it to match ONLY "2" in the second file. Currently, it is returning anything with a "2" in it.
So 22, 122, 102, etc are all coming back as matches, when I want only "2".
Now I know in Excel VBA you can use lookin:=xlWhole as a flag for the find command to achieve this - however I have been unable to reproduce this function using vbscript.
relevant code:
trialacct = objSheet.Cells(intRow, 1).value
set objRange = objSheet3.UsedRange
set objTarget = objRange.Find(trialacct)
That code works for looking up the value in column 1 of sheet one, then finding it in the second file (sheet3). But again, it's matching against any appearance of that value, when I want it to match the exact value. So "2" should only return "2" and not "22" as a match.
Hope this makes sense, and I really hope someone can help me out in finishing this off!
I've spent the better part of the day working on this, and it's working great except for 1 small issue (well, it's a large issue to the end result but a small code issue).
What I am doing is comparing the values in column1 of an excel file, then searching column 3 of a second excel file for that value, and if it matches return column 4 of the second file.
The code works great, except it's matching on any appearance of that value, and not the exact value only.
What I mean is that if column1 has a value of "2", I need it to match ONLY "2" in the second file. Currently, it is returning anything with a "2" in it.
So 22, 122, 102, etc are all coming back as matches, when I want only "2".
Now I know in Excel VBA you can use lookin:=xlWhole as a flag for the find command to achieve this - however I have been unable to reproduce this function using vbscript.
relevant code:
trialacct = objSheet.Cells(intRow, 1).value
set objRange = objSheet3.UsedRange
set objTarget = objRange.Find(trialacct)
That code works for looking up the value in column 1 of sheet one, then finding it in the second file (sheet3). But again, it's matching against any appearance of that value, when I want it to match the exact value. So "2" should only return "2" and not "22" as a match.
Hope this makes sense, and I really hope someone can help me out in finishing this off!