Align Right footer text to Left

J

Joel Mills

Using Excel 2000. How do you align text to the left in the Right Footer.
I've tried using & L but can't seem to make it work. Below is the code as
written so far.

Joel Mills

Sub MultiRight()
With ActiveSheet.PageSetup
Dim RF1 As String
Dim RF2 As String
Dim RF3 As String
Dim RF4 As String
RF1 = InputBox("Enter 1st Line of Footer")
RF2 = InputBox("Enter 2nd Line of Footer")
RF3 = InputBox("Enter 3rd Line of Footer")
RF4 = InputBox("Enter 4th Line of Footer")
.RightFooter = RF1 & Chr(10) & L & RF2 & Chr(10) & L _
& RF3 & Chr(10) & L & RF4 & Chr(10) & L
End With
End Sub
 
T

theDude

Hi Joel,

Use &L (remove the space between the ampersand and the L). It will
left-align the text, but in my testing, it moves the text so it appears
in the same position as the Left Footer text...

Hope this helps!
theDude
 
J

Joel Mills

Dude,

Thanks for your reply. When I remove the space between the ampersand "&",
excel puts it back.
 
T

theDude

Hi Joel,

I apologize for omitting that you need to wrap the format code i
quotation marks "&L"...but as I said above, if you use the 'Left-align
format code in the right footer, it moves the data to the left footer.
Run this code to test it out:

Code
-------------------
Sub MultiRight3()
Dim RF1 As String
Dim RF2 As String
Dim RF3 As String
Dim RF4 As String

RF1 = InputBox("Enter 1st Line of Footer")
RF2 = InputBox("Enter 2nd Line of Footer")
RF3 = InputBox("Enter 3rd Line of Footer")
RF4 = InputBox("Enter 4th Line of Footer")

With ActiveSheet.PageSetup
.LeftFooter = ""
.CenterFooter = "Center Footer" & Chr(10) & Chr(10) & Chr(10)
.RIGHTFOOTER = \"&L\" & RF1 & CHR(10) & \"&L\" & RF2 & CHR(10) & \"&L\" _
& RF3 & CHR(10) & \"&L\" & RF
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(0.65)
.BottomMargin = Application.InchesToPoints(0.87)
.HeaderMargin = Application.InchesToPoints(0.25)
.FooterMargin = Application.InchesToPoints(0.25)
End With
End Su
-------------------


It's the same as putting your variables in the left footer directl
(this code produces the same result):

Code
-------------------
Sub MultiRight2()
Dim RF1 As String
Dim RF2 As String
Dim RF3 As String
Dim RF4 As String

RF1 = InputBox("Enter 1st Line of Footer")
RF2 = InputBox("Enter 2nd Line of Footer")
RF3 = InputBox("Enter 3rd Line of Footer")
RF4 = InputBox("Enter 4th Line of Footer")

With ActiveSheet.PageSetup
.LEFTFOOTER = RF1 & CHR(10) & RF2 & CHR(10) & RF3 & CHR(10) & RF
.CenterFooter = "Center Footer" & Chr(10) & Chr(10) & Chr(10)
.RightFooter = "Right Footer" & Chr(10) & Chr(10) & Chr(10)
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(0.65)
.BottomMargin = Application.InchesToPoints(0.87)
.HeaderMargin = Application.InchesToPoints(0.25)
.FooterMargin = Application.InchesToPoints(0.25)
End With
End Su
-------------------


One last bit of info - The total character count for the left, center
right footer combined is only 255, so you might want to include an erro
check to ensure that the total length isn't exceeded since there's
prompts that a user can add data...

Hope this helps,
theDud
 
J

Joel Mills

Dude,

I copied both of your procedures. Couldn't get the first to work. Not sure
why. The Line with backslashes is red when pasted. I tried adding the "&L"
to my code and when I do, even though it is RightFooter = when I added the
"&L" to the code it place the input into the left footer not the right
footer.

Since I posted this I've asked another question concering a Chart Title and
input boxes. I modified that code for the Right Footer, but haven't been
able to align to the left. Are you sure that the right footer text can be
aligned left? Below is my code as it stands now. Can it be modified to
align left?

Sub FooterRight()

Dim RightFooter As String, RightStr As String, i As Integer


RightFooter = ""
For i = 1 To 4
RightStr = InputBox("Enter line " & i & " of Chart Title" _
and Hit Enter or Click Okay")
If RightStr <> "" Then
RightFooter = RightFooter + RightStr + Chr(10)
Else
Exit For
End If
Next i
With ActiveSheet.PageSetup
RightFooter = RightFooter
If RightFooter <> "" Then
' Replace only if there is an entry in RightFooter
.RightFooter = RightFooter
End If
End With

End Sub
 
T

theDude

Hi Joel,

Essentially, you're 'hosed' trying to justify text in each section of
the footer in Excel 2000. As you experienced, by adding a format code
within a footer section that doesn't match the sections' alignment, the
text appears in the footer section corresponding to the format code
used:

Format code "&L" (Left-align) moves text to the Left footer 'section'
Format code "&C" (Center-align) moves text to the Center footer
'section'
Format code "&R" (Right-align) moves text to the Right footer
'section'

It won't justify text within a footer section (contrary to what the
Help info leads you to believe). Maybe in newer versions it may...As
an alternative, you may be able to 'pad' the text w/leading or trailing
spaces in a footer section to get it positioned where you want it.

Hope this helps,
theDude
 
J

Joel Mills

Dude,

Thanks again for your help. I pretty much figured that alignment must not
be an adjustable property within headers or footers. Since this is the
case, and my users can't make them adjust manually, I'm not going to spend a
lot of time trying to make them adjust by using padding. Once again thanks
for the reply.

Joel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top