Consulting

Results 1 to 5 of 5

Thread: Adding a Column Total to a Printed Report

  1. #1

    Post Adding a Column Total to a Printed Report

    Hi All:

    I have a fairly basic spreadsheet which is intended to track time spent on a particular project (in days).

    When printing a worksheet in this book, I want to be able to print a sum of a column at the end of the report...

    Can somebody asisst with this?

    Yours hopefully,



    John

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by jchapman1964
    I have a fairly basic spreadsheet which is intended to track time spent on a particular project (in days).

    When printing a worksheet in this book, I want to be able to print a sum of a columnat the end of the report...
    Could you not just add a sum formula in the worksheet?

  3. #3
    Thanks for the reply!

    I am sure that is what I need to do, but how do I get this to happen when I click on print? It needs to be done ideally so that a sum of a column is placed in the footer? understand this can be done through VBA but not being an expert.......??

    J

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by jchapman1964
    I am sure that is what I need to do, but how do I get this to happen when I click on print? It needs to be done ideally so that a sum of a column is placed in the footer? understand this can be done through VBA but not being an expert.......??J
    I meant add it to the worksheet... but if you want it in the footer, then try

    Private Sub Workbook_BeforePrint(Cancel As Boolean)
    With ActiveSheet
    If .Name = "Sheet1" Then
    .PageSetup.LeftFooter = "Total = " & _
    Application.Sum(Range("A:A"))
    End If
    End With
    End Sub
    This is workbook event code. 'To input this code, right click on the Excel icon on the worksheet (or next to the File menu if you maximise your workbooks), select View Code from the menu, and paste the code

  5. #5
    Thats Great!

    Many thanks.....

Posting Permissions

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