View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Only print cells with values

Here is some pseudo code

assume you have sheets

summarylist list of contributors, 1 per row
Detail weekly contributions 52 wks x member rows
form sheet to print out

You want to copy the up to 52 rows of data form detail to form for printout
for each paying member.


with worksheets("SummaryList")
set rng = .Range(.Cells(2,1),.Cells(2,1).End(xldown))
End With
for each cell in rng
' to see if has given this year - check column F
if cell.offset(0,5) 0 then
' Clear form sheet
Worksheets("Form").Range("A5:A56").EntireRow.Clear Contents
' use cell as a filter criteria on detail sheet
With worksheets("Detail").Range("A1").currentRegion
.Autofilter Field:=1, Criteria1:=cell.value
.rows.copy Worksheets("Form").Range("A5")
End With
with worksheets("form")
.range("B2").Value = cell
.range("J2").Value = Date
.printout
End with
end if
Next

--
Regards,
Tom Ogilvy


"Oldjay" wrote:

I have a membership list that lists the church contributions made each week
and also gives the total cntributions for the year.
I want to print out a separate form for each member that has contributed
money during the year for income tax purposes
Thanks in advance