VBA to do this - truncate last guys

If let say I am storing letters and spaces  in this string called vbString like this>>

Dim vbString as string, endProduct as string
Dim upperLimit as long

upperLimit = 200

Vbstring = “zxzXZXzXzXzXzXzXzXzXZXzXzXzxxzXzXzXzXzXzXzXzXzXzxzXzxxzXzXZXXZXsdsadasdasd dsadasdasdasd”

endProduct =  myFunc (vbString)

I need to create function that looks at the upper max limit of text character count and then keeps only the first characters in the string that fall within that limit (first 200 characters ) and the rest of the end characters are truncated or removed from it.

Hence endProduct now has only the 200 first characters in it.
Who is Participating?
NorieConnect With a Mentor VBA ExpertCommented:
If you want the first 200 characters of a string use Left.
endProduct = Left(vbString, 200)

Open in new window

Ess KayEntrapenuerCommented:
trunicates everything or just upper characters
RayneAuthor Commented:
awesome imnorie :)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.