How to use Rtrim in excel

daniel -  
Mytå Posted messages 4246 Registration date   Status Contributor Last intervention   -
Hello,
I can't use the Rtrim function in Excel
how do I do it?
thank you for your help
Daniel

Configuration: Windows XP / Firefox 3.6.8

5 answers

  1. daniel
     
    Hello,
    I am a complete novice and so I was simply asking where to enter the proposed terms and hit F1
    Thank you
    1
  2. Mytå Posted messages 4246 Registration date   Status Contributor Last intervention   957
     
    Hello forum

    A little reminder about F1 on Rtrim

    This example uses the LTrim and RTrim functions to eliminate spaces on the left and right of a string variable, respectively. The Trim function eliminates both types of spaces.

     Dim MyString, TrimString MyString = " <-Trim-> " ' Initializes the string. TrimString = LTrim(MyString) ' TrimString = "<-Trim-> ". TrimString = RTrim(MyString) ' TrimString = <-Trim->". TrimString = LTrim(RTrim(MyString)) ' TrimString = "<-Trim->". ' Using the Trim function alone produces the same result. TrimString = Trim(MyString) ' TrimString = "<-Trim->". 

    Mytå

    Thank you for your question, we are not robots...
    Installed versions [MsProject 2003(FR), Excel 2003-2007(FR)]
    0
  3. daniel
     
    Thank you, but I still don't know how to use this function
    should it be placed at the top of the list...
    thank you
    0
  4. Patrice33740 Posted messages 8400 Registration date   Status Member Last intervention   1 783
     
    Hello,

    The example of Mytå seems clear to me, your question much less so, could you provide more details on what you would like?
    0
  5. Patrice33740 Posted messages 8400 Registration date   Status Member Last intervention   1 783
     
    Re,

    Actually, the Rtrim function is not an Excel function; it is a Visual Basic for Applications (VBA) function. VBA is a programming language for applications like Excel, Word...

    In Excel, there is no equivalent for Rtrim and Ltrim, but there is an equivalent for the Trim function, which is TRIM().

    Since you are a novice, I recommend that you familiarize yourself with using Excel to acquire a basic level of mastery before diving into programming an application whose functioning you do not understand well enough.

    As our neighbors say: He who goes slowly, goes safely and goes far.

    Sincerely
    0
    1. Mytå Posted messages 4246 Registration date   Status Contributor Last intervention   957
       
      Hello the forum

      Thank you for taking over Patrice

      Mytå
      0
    2. daniel
       
      thank you
      I will study, but I needed to purge these .... whites
      thank you
      0
    3. Mytå Posted messages 4246 Registration date   Status Contributor Last intervention   957
       
      Re the forum

      Daniel, press Alt+F11 and paste this macro into a module.

      Then run the macro to see the result.

       Sub MacroTrim() Cells(1, 1) = " Test Macro Daniel " Cells(2, 1) = LTrim(Cells(1, 1)) Cells(3, 1) = RTrim(Cells(1, 1)) Cells(4, 1) = Trim(Cells(1, 1)) End Sub

      Mytå
      0
    4. Mytå Posted messages 4246 Registration date   Status Contributor Last intervention   957
       
      Hello forum

      Daniel, if the TRIM function isn't working, you might be dealing with non-breaking spaces: that's ALT+0160

      Replace the first line of the macro and you'll see the result.

      Cells(1, 1) = Chr(160) & " Test Macro Daniel " & Chr(160)

      Using REPLACE will allow you to do the job

      LTrim(Replace(Cells(1, 1), Chr(160), " "))

      Looking forward to hearing from you
      Mytå
      0
    5. daniel
       
      Thank you, Myta, I'll give it a try and let you know.
      0