<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: right justify a string in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/right-justify-a-string/m-p/1931989#M26066</link>
    <description>Hi Joe. Should the function return the value, like this:&lt;BR /&gt;
[code]&lt;BR /&gt;
Public Function RightJustifyFixedLengthString(FixedLengthString As String) As String&lt;BR /&gt;
    RightJustifyFixedLengthString = Right(FixedLengthString, Len(FixedLengthString) - _&lt;BR /&gt;
    Len(RTrim(FixedLengthString))) &amp;amp; RTrim(FixedLengthString)&lt;BR /&gt;
End Function[/code]&lt;BR /&gt;
&lt;BR /&gt;
Also, this worked for me. It padded two spaces in front.&lt;BR /&gt;
[code]&lt;BR /&gt;
    FixedLengthString = "1.000"&lt;BR /&gt;
    FixedLengthString = "  " &amp;amp; FixedLengthString[/code]&lt;BR /&gt;
You would just have to calculate how many spaces to use. Granted, that might take more code than what you came up with, but it just seemed like you were saying that adding spaces didn't work.</description>
    <pubDate>Tue, 03 Apr 2007 21:21:59 GMT</pubDate>
    <dc:creator>Ed__Jobe</dc:creator>
    <dc:date>2007-04-03T21:21:59Z</dc:date>
    <item>
      <title>right justify a string</title>
      <link>https://forums.autodesk.com/t5/vba-forum/right-justify-a-string/m-p/1931986#M26063</link>
      <description>Hopefully there is an easy answer to this question but I'm at a lose for the &lt;BR /&gt;
moment.&lt;BR /&gt;
&lt;BR /&gt;
Dim X As String * 10&lt;BR /&gt;
&lt;BR /&gt;
    X = "1.000"&lt;BR /&gt;
&lt;BR /&gt;
I want X to equal "     1.000"&lt;BR /&gt;
&lt;BR /&gt;
Thanks!&lt;BR /&gt;
&lt;BR /&gt;
Joe ...</description>
      <pubDate>Tue, 03 Apr 2007 19:34:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/right-justify-a-string/m-p/1931986#M26063</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-04-03T19:34:09Z</dc:date>
    </item>
    <item>
      <title>Re: right justify a string</title>
      <link>https://forums.autodesk.com/t5/vba-forum/right-justify-a-string/m-p/1931987#M26064</link>
      <description>... doesn't work to simply embed a space?&lt;BR /&gt;
X = " 1.0000"</description>
      <pubDate>Tue, 03 Apr 2007 20:03:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/right-justify-a-string/m-p/1931987#M26064</guid>
      <dc:creator>mdhutchinson</dc:creator>
      <dc:date>2007-04-03T20:03:29Z</dc:date>
    </item>
    <item>
      <title>Re: right justify a string</title>
      <link>https://forums.autodesk.com/t5/vba-forum/right-justify-a-string/m-p/1931988#M26065</link>
      <description>Nope, but I came up with this solution. Watch out for word-wrapping!&lt;BR /&gt;
&lt;BR /&gt;
Joe ...&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Public Function RightJustifyFixedLengthString(FixedLengthString As String) &lt;BR /&gt;
As String&lt;BR /&gt;
  FixedLengthString = Right(FixedLengthString, Len(FixedLengthString) - &lt;BR /&gt;
Len(RTrim(FixedLengthString))) &amp;amp; RTrim(FixedLengthString)&lt;BR /&gt;
End Function&lt;BR /&gt;
&lt;BR /&gt;
Public Sub Test()&lt;BR /&gt;
Dim FixedLengthString As String * 10&lt;BR /&gt;
  FixedLengthString = "1.000"&lt;BR /&gt;
  RightJustifyFixedLengthString FixedLengthString&lt;BR /&gt;
  Debug.Print FixedLengthString&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;HUTCH&gt; wrote in message news:5540385@discussion.autodesk.com...&lt;BR /&gt;
... doesn't work to simply embed a space?&lt;BR /&gt;
X = " 1.0000"&lt;/HUTCH&gt;</description>
      <pubDate>Tue, 03 Apr 2007 20:18:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/right-justify-a-string/m-p/1931988#M26065</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-04-03T20:18:21Z</dc:date>
    </item>
    <item>
      <title>Re: right justify a string</title>
      <link>https://forums.autodesk.com/t5/vba-forum/right-justify-a-string/m-p/1931989#M26066</link>
      <description>Hi Joe. Should the function return the value, like this:&lt;BR /&gt;
[code]&lt;BR /&gt;
Public Function RightJustifyFixedLengthString(FixedLengthString As String) As String&lt;BR /&gt;
    RightJustifyFixedLengthString = Right(FixedLengthString, Len(FixedLengthString) - _&lt;BR /&gt;
    Len(RTrim(FixedLengthString))) &amp;amp; RTrim(FixedLengthString)&lt;BR /&gt;
End Function[/code]&lt;BR /&gt;
&lt;BR /&gt;
Also, this worked for me. It padded two spaces in front.&lt;BR /&gt;
[code]&lt;BR /&gt;
    FixedLengthString = "1.000"&lt;BR /&gt;
    FixedLengthString = "  " &amp;amp; FixedLengthString[/code]&lt;BR /&gt;
You would just have to calculate how many spaces to use. Granted, that might take more code than what you came up with, but it just seemed like you were saying that adding spaces didn't work.</description>
      <pubDate>Tue, 03 Apr 2007 21:21:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/right-justify-a-string/m-p/1931989#M26066</guid>
      <dc:creator>Ed__Jobe</dc:creator>
      <dc:date>2007-04-03T21:21:59Z</dc:date>
    </item>
    <item>
      <title>Re: right justify a string</title>
      <link>https://forums.autodesk.com/t5/vba-forum/right-justify-a-string/m-p/1931990#M26067</link>
      <description>Ed,&lt;BR /&gt;
&lt;BR /&gt;
That's what my code does. It takes the len of the whole string - the length &lt;BR /&gt;
of the actual string = the amount of space needed. Then concate the actual &lt;BR /&gt;
string to the pad and that's it.&lt;BR /&gt;
&lt;BR /&gt;
Joe ...&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;ED_JOBE&gt; wrote in message news:5540481@discussion.autodesk.com...&lt;BR /&gt;
Hi Joe. Should the function return the value, like this:&lt;BR /&gt;
[code]&lt;BR /&gt;
Public Function RightJustifyFixedLengthString(FixedLengthString As String) &lt;BR /&gt;
As String&lt;BR /&gt;
    RightJustifyFixedLengthString = Right(FixedLengthString, &lt;BR /&gt;
Len(FixedLengthString) - _&lt;BR /&gt;
    Len(RTrim(FixedLengthString))) &amp;amp; RTrim(FixedLengthString)&lt;BR /&gt;
End Function[/code]&lt;BR /&gt;
&lt;BR /&gt;
Also, this worked for me. It padded two spaces in front.&lt;BR /&gt;
[code]&lt;BR /&gt;
    FixedLengthString = "1.000"&lt;BR /&gt;
    FixedLengthString = "  " &amp;amp; FixedLengthString[/code]&lt;BR /&gt;
You would just have to calculate how many spaces to use. Granted, that might &lt;BR /&gt;
take more code than what you came up with, but it just seemed like you were &lt;BR /&gt;
saying that adding spaces didn't work.&lt;/ED_JOBE&gt;</description>
      <pubDate>Wed, 04 Apr 2007 00:54:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/right-justify-a-string/m-p/1931990#M26067</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-04-04T00:54:03Z</dc:date>
    </item>
    <item>
      <title>Re: right justify a string</title>
      <link>https://forums.autodesk.com/t5/vba-forum/right-justify-a-string/m-p/1931991#M26068</link>
      <description>Yes, I knew that, but I think I misread Hutch's response and therefore what you were saying "Nope" to. Sorry.</description>
      <pubDate>Wed, 04 Apr 2007 14:27:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/right-justify-a-string/m-p/1931991#M26068</guid>
      <dc:creator>Ed__Jobe</dc:creator>
      <dc:date>2007-04-04T14:27:00Z</dc:date>
    </item>
    <item>
      <title>Re: right justify a string</title>
      <link>https://forums.autodesk.com/t5/vba-forum/right-justify-a-string/m-p/1931992#M26069</link>
      <description>Not a problem, I appreciate the feedback.&lt;BR /&gt;
&lt;BR /&gt;
Joe ...&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;ED_JOBE&gt; wrote in message news:5541209@discussion.autodesk.com...&lt;BR /&gt;
Yes, I knew that, but I think I misread Hutch's response and therefore what &lt;BR /&gt;
you were saying "Nope" to. Sorry.&lt;/ED_JOBE&gt;</description>
      <pubDate>Wed, 04 Apr 2007 15:16:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/right-justify-a-string/m-p/1931992#M26069</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-04-04T15:16:59Z</dc:date>
    </item>
  </channel>
</rss>

