LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Macro to list report results

I have no idea what etc means for you data layout, but maybe this would help:

Option Explicit
Sub BenefitsReport()

Dim Folder As String
Dim fName As String
Dim ZoomSht As Worksheet
Dim RptSht As Worksheet
Dim NextRow As Long
Dim LastRow As Long
Dim RowCount As Long

Folder = "C:\Users\Andrew\Documents\M-Link\Benefit Reports\"
fName = " TDMP Benefits Report.pdf"

Set RptSht = Worksheets("Benefits Report")
With RptSht
'assumes column A in the rptsht is always used
'if that row has data on it
NextRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With

Set ZoomSht = Sheets("Zoomerang Data")
With ZoomSht
LastRow = .Range("A" & Rows.Count).End(xlUp).Row
For RowCount = 11 To 1500
.Rows(RowCount).Copy _
Destination:=.Rows(2)

With RptSht.Cells(NextRow, "A")
.NumberFormat = "mm/dd/yyyy hh:mm:ss"
.Value = Now
End With

With RptSht.Cells(NextRow, "B")
.Value = Application.UserName
End With

'change the "sending" addresses to what you need
RptSht.Cells(NextRow, "C").Value = .Range("D18").Value
RptSht.Cells(NextRow, "D").Value = .Range("x92").Value
RptSht.Cells(NextRow, "E").Value = .Range("A7").Value

Sheets("Benefits Report").ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=Folder & _
.Range("H" & RowCount) & _
fName, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
Next RowCount
End With
End Sub

GeorgeA wrote:

Hello,
The macro below copies and pastes a row of data from sheet 'Zoomerang Data'
into row 2 and calculations reference that row. The results are formatted
into a report and the macro saves the report in PDF and then copies the next
data row and overwrites Row 2, etc... It works great (Thanks Joel!) but I
have to open each PDF to verify the results.
I have made a new sheet called Results that references the required fields
in the 'Benefits Report' sheet (ie. ='Benefits Report'!D18, etc..). I'd like
to end up with rows of data that show the results of each report, but I get
stuck because the macro below always overwrites the last row the row for
calculations and I don't know how to keep the results from overwriting. I was
trying Paste Values but then I lose the references in the Results fields. Can
someone help me out. Thanks!

Sub BenefitsReport()
'
' BenefitsReport Macro
'

Folder = "C:\Users\Andrew\Documents\M-Link\Benefit Reports\"
FName = " TDMP Benefits Report.pdf"
'
Set ZoomSht = Sheets("Zoomerang Data")
With ZoomSht
LastRow = .Range("A" & Rows.Count).End(xlUp).Row
For RowCount = 11 To 1500
.Rows(RowCount).Copy _
Destination:=.Rows(2)
Sheets("Benefits Report").ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=Folder & _
.Range("H" & RowCount) & _
FName, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
Next RowCount
End With
End Sub


--

Dave Peterson
 
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
Using a macro to make a list from results deemo85 Excel Discussion (Misc queries) 1 June 2nd 08 02:43 PM
Using a macro to make a list from Results deemo85 New Users to Excel 1 June 2nd 08 02:01 PM
Using a Macro to make a list from results deemo85 Excel Discussion (Misc queries) 0 June 2nd 08 12:03 PM
Report row results based on the last data entry in a column par4724 via OfficeKB.com Excel Discussion (Misc queries) 2 March 27th 08 09:41 AM
how do I report data of court cases ,results,analysis,..... Ziad NT New Users to Excel 4 May 12th 06 11:40 PM


All times are GMT +1. The time now is 12:37 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"