Possible Duplicate:
Substring in VBA
I’m wondering how to short down a long string (every string over 300 characters) located in a cell, to be exactly 300 characters.
for example, lets assume “aaaaadd” is 302 characters including “dd”.
so the resault will be “aaaaa”
If you’re just looking for a formula (and not VBA), you can use the
LEFTformula:This will truncate the string to 300 characters, and in cases where the string is less than 300 characters it will just return the string. If you need to use VBA, the syntax is basically the same. For example, if you wanted to perform that operation on cell
A1:Here, the first argument to
LEFTis the value of cellA1, and the result of the truncating is stored in variableMyString.