Thanks all for your comments. I manageed to solve it in the end, by removing my sloppy, trailing spaces. Erik, I did already think of that, I ran the subroutine as seperate file altogether and got the same error, which is how I knew it was in there. Thanks anyway.