+ Reply to Thread
Results 1 to 13 of 13

auto populate list

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    06-20-2007
    Location
    Buckeye, AZ
    MS-Off Ver
    365
    Posts
    298

    auto populate list

    In the attached workbook, is it possible to auto populate from 'Time Sheets'!columns C,D and E to 'Dashboard'! B6:B36, E6:E36, H6:H36 a list of all names that fall within 'Dashboard'! "week ending" criteria?
    Thanks for any and all help!
    Sick
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    10-18-2012
    Location
    Telford, England
    MS-Off Ver
    Excel 2010 (2003)
    Posts
    294

    Re: auto populate list

    Yes with a little VBA. I infer...
    a) you do not expect (= cannot ever have) more than 31 entries that are within the weekend
    b) that by <fall within 'Dashboard'! "week ending" criteria > you mean have a date 0-6 days earlier than the date in C2

    I could do this for you if no-one else is dashing it off as i write!

  3. #3
    Forum Contributor
    Join Date
    06-20-2007
    Location
    Buckeye, AZ
    MS-Off Ver
    365
    Posts
    298

    Re: auto populate list

    is "31" a reference to the size allotted on the sheet or a "max allowed"?

  4. #4
    Forum Contributor
    Join Date
    10-18-2012
    Location
    Telford, England
    MS-Off Ver
    Excel 2010 (2003)
    Posts
    294

    Re: auto populate list

    The length of the yellow ranges where the data is to go

  5. #5
    Forum Contributor
    Join Date
    06-20-2007
    Location
    Buckeye, AZ
    MS-Off Ver
    365
    Posts
    298

    Re: auto populate list

    If you could configure it for 100 entries:
    1. I'd learn how to do it.
    2. I could adjust it if needed.
    Even I can change yellow fill. LOL!
    Sick

  6. #6
    Forum Contributor
    Join Date
    10-18-2012
    Location
    Telford, England
    MS-Off Ver
    Excel 2010 (2003)
    Posts
    294

    Re: auto populate list

    Bother, missed out S + S + 1 which must be inserted below the If statement

    Incidentally will cope without arbirary limit (31, 100, whatever)

  7. #7
    Forum Contributor
    Join Date
    06-20-2007
    Location
    Buckeye, AZ
    MS-Off Ver
    365
    Posts
    298

    Re: auto populate list

    You mean like this? I took off E from hours.

    HTML Code: 

  8. #8
    Forum Contributor
    Join Date
    10-18-2012
    Location
    Telford, England
    MS-Off Ver
    Excel 2010 (2003)
    Posts
    294

    Re: auto populate list

    I think this is about right:
    Option Explicit
    Dim ws As Worksheet
    Dim R As Integer, S As Integer
    
    
    Sub doit()
        Sheets("Time Sheet").Activate
        Set ws = Sheets("Dashboard")
        With ws
            Date2 = .Range("C2")
            Date1 = Date2 - 6
            
            S = 6   ' Start Row Dashboard (I assume its empty)
            
            For R = 6 To ActiveSheet.UsedRange.Rows.Count
                If Cells(R, 2) >= Date1 And Cells(R, 2) <= Date2 Then  ' record
                    .Cells(S, 2) = Cells(R, 3)  ' employee
                    .Cells(S, 5) = Cells(R, 4)  ' job
                    .Cells(S, 8) = Cells(R, 5)  ' Process
                    
                    .Cells(S, 3) = Cells(R, 6)  ' Hourse
                    .Cells(S, 6) = Cells(R, 6)  ' Hourse
                    .Cells(S, 93) = Cells(R, 6)  ' Hourse
                End If
            Next
    End Sub
    good luck. (Going home now so cannot reply quickly)

  9. #9
    Forum Contributor
    Join Date
    10-18-2012
    Location
    Telford, England
    MS-Off Ver
    Excel 2010 (2003)
    Posts
    294

    Re: auto populate list

    Option Explicit
    Dim ws As Worksheet
    Dim R As Integer, S As Integer
    
    
    Sub doit()
        Sheets("Time Sheet").Activate
        Set ws = Sheets("Dashboard")
        With ws
            Date2 = .Range("C2")
            Date1 = Date2 - 6
            
            S = 6   ' Start Row Dashboard (I assume its empty)
            
            For R = 6 To ActiveSheet.UsedRange.Rows.Count
                If Cells(R, 2) >= Date1 And Cells(R, 2) <= Date2 Then  ' record
                    .Cells(S, 2) = Cells(R, 3)  ' employee
                    .Cells(S, 5) = Cells(R, 4)  ' job
                    .Cells(S, 8) = Cells(R, 5)  ' Process
                    
                    .Cells(S, 3) = Cells(R, 6)  ' Hours
                    .Cells(S, 6) = Cells(R, 6)  ' Hours
                    .Cells(S, 9) = Cells(R, 6)  ' Hours
                    S + S + 1   
                End If
            Next
    End Sub
    Moved S + S +1 and corrected last .cells.... line
    Last edited by brynbaker; 03-28-2013 at 02:05 PM. Reason: correction

  10. #10
    Forum Contributor
    Join Date
    06-20-2007
    Location
    Buckeye, AZ
    MS-Off Ver
    365
    Posts
    298

    Re: auto populate list

    the S + S + 1 keeps changing to S S + 1.
    Still not working. I paste the code, save, close and reopen. Nope.

  11. #11
    Forum Contributor
    Join Date
    10-18-2012
    Location
    Telford, England
    MS-Off Ver
    Excel 2010 (2003)
    Posts
    294

    Re: auto populate list

    That's what happens when you type in something in a hurry. S = S + 1 will be huch happier

  12. #12
    Forum Contributor
    Join Date
    10-18-2012
    Location
    Telford, England
    MS-Off Ver
    Excel 2010 (2003)
    Posts
    294

    Re: auto populate list

    That's what happens when you type in something in a hurry. S = S + 1 will be huch happier

  13. #13
    Forum Contributor
    Join Date
    06-20-2007
    Location
    Buckeye, AZ
    MS-Off Ver
    365
    Posts
    298

    Re: auto populate list

    OK. This is what I have in Thisworkbook (Code)
    HTML Code: 
    Still not working. What have I missed?
    Sick

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1