Hi,
You may not be able to set different footer for each page in Excel (I may be
wrong). However, you can print out your document with the conditional
placing of footer using the following code.
'Start---------------------------------------------
Sub setFooter(pageType As String)
'
If pageType = "odd" Then
With ActiveSheet.PageSetup
.LeftFooter = "page: &P"
.RightFooter = ""
End With
Else
With ActiveSheet.PageSetup
.LeftFooter = ""
.RightFooter = "page: &P"
End With
End If
End Sub
'--------------------------------------------------
Sub printPage()
Dim i As Integer, n As Integer
n = 2 'number of pages to be printed
For i = 1 To n
If i Mod 2 = 1 Then
setFooter ("odd")
Else
setFooter ("even")
End If
ActiveSheet.PrintOut i, i
Next i
End Sub
'END----------------------------------
Akhilesh Kumar Karna
On Tue, Mar 24, 2009 at 4:45 AM, [email protected]
<[email protected]>wrote:
>
> I'm trying to find a VBA solution so that the footer for my multi-page
> spreadsheet has the page # on the outside.
> This is trivial in Word as it has an odd-and-even footer option.
>
> My initial thought is to take the current page # with the mod 2
> function to determine if the page is odd or even.
> Then, if the page is odd, set the page # into the right footer.
> If the page is even, set the page # into the left footer.
> I can't find an example of how to implement that, however.
>
> Any hints or pointing me to an example would be most appreciated.
>
> Urban Landreman
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
-------------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
To post to this group, send email to [email protected]
If you find any spam message in the group, please send an email to:
Ayush Jain @ [email protected] or
Ashish Jain @ [email protected]
-------------------------------------------------------------------------------------
-~----------~----~----~----~------~----~------~--~---