You should only have to use InstrRev once as this function searchs from the end of the string. huyhk's code will work fine as it is.