View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
jonco jonco is offline
external usenet poster
 
Posts: 53
Default Gathering data from all worksheets for a report

I'm want to generate a report by gathering info from certain cells on all
but 4 spreadsheets in a workbook.
I want the selected data from each worksheet to go into a row on the
"Reports" worksheet starting at row 5 (under the headings that remain
constant)
This is what I have so far:
Sub ReportBasic()

Sheets("Reports").Select ' This is the sheet that has the report format
Range("A5").Select ' This is where the first item form the first
worksheet will go

For Each Worksheet In ThisWorkbook.Worksheets

Select Case Worksheet.Name
Case "Index", "Trans", "Customers", "Reports" ' Sheets that I won't pull
data from
'don't do anything
Case Else

' Gather data from valid worksheet

Set CustName = ActiveSheet.Range("A1")
Set CustNumber = ActiveSheet.Range("G1")
Set Limit = ActiveSheet.Range("I2")
Set Freq = ActiveSheet.Range("J2")
Set DueDate = ActiveSheet.Range("L2")
Set Status = ActiveSheet.Range("M2")
Set Total = ActiveSheet.Range("R1")
Set LastPaid = ActiveSheet.Range("N2")
Set LastPaidAmt = ActiveSheet.Range("O2")

' Insert Customer Info on report
Sheets("Reports").Select
ActiveCell.Value = CustNumber
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = CustName
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Total
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = DueDate
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Freq
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Limit
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Status
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = LastPaid
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = LastPaidAmt
ActiveCell.FormulaR1C1 = CustName
'
End Select
Next

End Sub


Any help is greatly appreciated.

Jonco