LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Code assistance needed

I've just come across this code in my archives, and it isn't
Working. It might be full of errors, but can someone assist is
Getting it on its feet?
Thanks in Advance.
Jim


Sub PrintSubTotalInFooter()
Dim lrow As Long
Dim numhpb As Long
Dim LPage As Long
Dim i As Integer
Dim STRng As Range
Application.EnableEvents = False
' The PageSetUp Print Range has already been set to Range A5:F149
Set STRng = Application.InputBox("Highlight the Range of Amts to be
Subtotaled", Type:=8)
rrows = Range(ActiveSheet.PageSetup.PrintTitleRows).Rows.C ount
With ActiveSheet
.PageSetup.RightFooter = ""
numhpb = .HPageBreaks.Count
LPage = numhpb + 1
For i = 1 To numhpb
.PageSetup.RightFooter = "Sub-total = " &
Format(WorksheetFunction.Sum _
(Range(STRng(1).Address, STRng(.HPageBreaks(i).Location.Row
- (1 + rrows)).Address)), "0,000.00")
On Error GoTo ErrorHandler
.PrintPreview i, i
Next i
.PageSetup.RightFooter = "The-total = " &
Format(WorksheetFunction.Sum _
(STRng), "0,000.00")
On Error GoTo ErrorHandler
.PrintPreview LPage, LPage
End With
ErrorHandler:
Application.EnableEvents = True
End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
CODE Assistance needed PLEASE please please N.F[_2_] Excel Discussion (Misc queries) 0 July 9th 07 08:36 PM
VBA Assistance Needed RalphB Excel Discussion (Misc queries) 5 February 22nd 06 06:16 PM
Code assistance needed HJ Excel Programming 7 May 27th 05 04:14 PM
Macro assistance needed HJ Excel Programming 3 November 2nd 04 10:46 PM
Assistance Needed with Comparing alexm999[_74_] Excel Programming 4 May 19th 04 10:04 PM


All times are GMT +1. The time now is 02:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"