Trim Function

Posted on 2000-04-26
Last Modified: 2010-05-02
Is it possible to use a Trim function and a Ucase Function on the same line of code?  If so how?
Question by:rickydoyle

Expert Comment

ID: 2751584
dim strStringOne
dim strStringTwo

strStringOne = "   HelLo TherE    "
strStringTwo = UCase(Trim(strStringOne))

This gives you "HELLO THERE" for strStringTwo.

Hope this helps -- b.r.t.

Expert Comment

ID: 2752714

You can conbine any number of functions together in the same line... including the mixture of your custom functions, VB standard functions, and API declared functions.  For example :

MyVariable = MyFunction(Left(Trim(TestVariable),2))


Accepted Solution

mathies earned 10 total points
ID: 2752974
strNewText = UCase(trim("Allo"))


Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
vba find the last empty column 10 88
VB error "Type mismatch" 2 49
Hide vba in gp 7 82
vb6, excel Run-time error 1004 method 'close' of object 'workbooks' failed 7 43
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now