Consulting

Results 1 to 2 of 2

Thread: Footers question in VBA

  1. #1
    VBAX Newbie
    Joined
    Nov 2012
    Posts
    2
    Location

    Footers question in VBA

    Hello Guys,

    I am currently working on a project at work to automate a report from data, i can do every page fine, some parts have one page and some parts have more than one page.

    My problem is simple on all singe pages i have one green line above the footer on the cells above it to match what the old report had which is what i am going for. this green line nicely started the footer

    Now on the parts with more than one page i can do this manually but i would like it automated the problem lies with finding the cell above the footer on each page.

    does anyone one know how to do this or another way of doing the same thing

    Many thanks

    Jason

  2. #2
    This might help you get started.

    Sub CheckForPageBreaks()
     Dim i As Integer
    
     For i = 1 to ActiveSheet.UsedRange.Rows.Count
         If Rows(i).PageBreak = xlManual then
             MsgBox "There is a manual page break above row " & i
         ElseIf Rows(i).PageBreak = xlAutomatic Then
             MsgBox "There is an automatic page break above row " & i
         End If
     Next
    End Sub


    Change the code to insert a green line as required instead of create a msgbox. Can't program it at the moment, as I'm at work... But this should be somewhat helpful to start you off.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •