PDA

View Full Version : [SOLVED:] Trim?



gibbo1715
09-14-2005, 11:45 AM
I ve seen the statement trim used as below


.Cells(i, 1) = Trim(TextBox1.Text)

can someone explain its use for me please as this is a new one on me

cheers

gibbo

Ken Puls
09-14-2005, 11:54 AM
Hey Gibbo,

Removes any excess spaces. See the attached example. :)

HTH,

MWE
09-14-2005, 12:18 PM
Trim removes leading and trailing blanks or spaces from a string variable. You can remove just the left or leading spaces with LTrim and just the right or trailing spaces with RTrim. Trim is pretty handy when you do not know if the text of interest may have a leading or trailing space or two.

Ken Puls
09-14-2005, 12:24 PM
Ah! Sorry, Gibbo. I was thinking of the Excel function. It also corrects all internal spaces to 1 space character where the VBA version does not.

Thanks for clarifying, Mark! :yes

gibbo1715
09-14-2005, 12:32 PM
That is extreamly useful thankyou

gibbo1715
09-14-2005, 12:33 PM
really useful

Thankyou

Gibbo