• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Capture only first 5 digits of a userform field to excel

Hello,

I am working on a userform and database. In my userform I have several fields that the info is then moved to the database. One field in particular is a 'selection' field where the user chooses one of 3 options. Each of those options begins with 5 digits that I need to copy to my database but all of the characters in the selection field are necessary for the user. How do I move only the first 5 digits to my userform using vba code? My code string is below:

Sheets("Travel Expense Voucher").Range("Data_Start").Offset(TargetRow,11.Value=cmbMileageRates

I know that this can be done in a spreadsheet by selecting the field, say B1, and using the following formula: =Left(B1,5) but I am unsure where to put that into my vba to make it happen since I am not using excel fields to enter the code. Please help?
 
Back
Top