title: In Excel, how do I add a footer to the last page only?
body: <p><strong>UPDATED 3/10/2015 @ 4:03PM</strong></p>
  
  <p>I'm trying to add a footer to the last page only in Excel, but crazily enough there isn't any options to do so within the program...you can only specify a custom footer for the first page and nothing else!</p>
  
  <p>I figured the only way I could achieve this would be through the use of VBA macros, but unfortunately any information online regarding the implementation of this functionality is easily 10+ years old and not really helping.</p>
  
  <p>Because of the limitations of the footer option, I thought I would try a different approach, which was to add a row at the bottom of the last page.</p>
  
  <p>I have the following code...</p>
  
  <pre><code>Sub pageBreak()
  
  LastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
  
  rows(LastRow &amp; ":200").Select
  Selection.Delete Shift:=xlUp
  
  ActiveSheet.PageSetup.PrintArea = "$A$1:$M$" &amp; LastRow + Unknown Value
  
  HowMany = ActiveSheet.HPageBreaks.Count
  
  WhatRow = ActiveSheet.HPageBreaks(HowMany).Location.Row - 4
  
  Range("A" &amp; CStr(WhatRow) &amp; ":L" &amp; CStr(WhatRow)).Merge
  
  rows(WhatRow).RowHeight = 54
  rows(WhatRow).VerticalAlignment = xlCenter
  rows(WhatRow).HorizontalAlignment = xlCenter
  rows(WhatRow).WrapText = True
  
  Range("A" &amp; CStr(WhatRow)) = Worksheets("Sheet2").Range("A1")
  
  End Sub
  </code></pre>
  
  <p>This almost works, but the catch is that it depends on page breaks being present, so let's say your content ended on page 2, you have to manually pull down the print-area to show a page 3, so there is a page break between 2/3 and then the code can be placed above it on page 2. So in my code, where it says <code>Unknown Value</code>, that has to be the amount needed between the LastRow and the triggering of the next page-break. Any ideas on how to do this?</p>