Results 1 to 2 of 2

Thread: Table generation

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2009
    Posts
    7

    Table generation

    Hi,

    (Excel)
    I'am trying to program a program which generates a summary table of raw data in another worksheet.

    The raw worksheets contains information concerning staff clocking.

    for example:
    Code:
    Name              Date In            Date Out          Delta Hours    Absence Hours
    Mister X          01/06/09          01/06/09                  2   
    Mister X          02/06/09          01/06/09                  2     
    Mister X          03/06/09          01/06/09                                  2
    ...                  
    Mister X          30/06/09          30/06/09                  8                
    Mister Y          01/06/09          01/06/09                  2   
    ...
    The raw data table contains over 9000 rows, for all staff members. Each day has it's own row.

    On the recap timesheet I would like to create a recap table:

    Name 01/06/09 02/06/09 03/06/09 ...
    Mister X 2 2 0
    Mister Y 2

    I created following code, however it doesn't seems to work.
    WS= recap worksheet
    WB.Worksheets(2)= raw data worksheet.
    The program is ran from an ms access form

    Code:
    Dim jRow As Integer
    For iRow = 2 To WS.Range("A" & WS.Rows.Count).End(xlUp).Row Step 1
    For iColumns = 2 To Daycount Step 1
    
    For jRow = 3 To WB.Worksheets(2).Range("A" & WB.Worksheets(2).Rows.Count).End(xlUp).Row Step 1
    If WB.Worksheets(2).Range("A" & jRow).Value = WS.Range("A" & iRow).Value Then
    WS.Cells(iRow, iColumns).Value = WB.Worksheets(2).Range("N" & jRow).Value
    
    End If
    Next
    
    Next

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Table generation

    it looks as if it would be simpler (and faster) to use a sumif formula for each mister
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Posting Permissions

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



Click Here to Expand Forum to Full Width