dimanche 1 mars 2015

remove value from end of string vba

This will be pretty simple for those versed in vba - I write it so rarely that I need a lot of help. I've seen a heap of threads and tutorials about manipulating strings, but none seem to capture what I'm attempting to do, working in excel, which is simply this:



  • remove the numbers from the end of the string, then move them to another cell.


e.g. "april 26 april 27 merchant 23.78" The goal is to take 23.78 out of the string and move it to an adjacent cell.


Simple enough, but there are string characteristics (problems) that I have not been able to solve:




  • target number is variable




  • target number length is variable




  • there are multiple numbers in the string, but only the numbers at the end (right) are targeted




Certainties




  • The target numbers are always at the end (right)




  • the target numbers are always separated from the rest of the string by a space




I'm thinking that a substring function that moves through characters from right to left and stops when a character is not a number (i.e. a space or a letter) might work well. Any suggestions the forum might have on writing such a query would be most helpful.


Thanks


Aucun commentaire:

Enregistrer un commentaire