+ Reply to Thread
Results 1 to 10 of 10

Need help building a loop

  1. #1
    Registered User
    Join Date
    05-28-2013
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    45

    Need help building a loop

    I need a loop that goes across columns, when it hits a cell E.G 'Team 1' the loop then goes down to a particular row E.G row 11 and fills in team member names that it gets from a list on a different sheet, once it has filled in all of 'Team 1' members, it goes back to moving across columns until it hits the next cell with E.G 'Team 2' ...

    Anyone able to provide some code or point me in the right way of a decent tutorial page?

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Need help building a loop

    look at for next loops, and offset.

    if you could attach a sample, I could illustrate.

  3. #3
    Registered User
    Join Date
    05-28-2013
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: Need help building a loop

    I've attached an example of what i am dealing with

    Thanks
    Attached Files Attached Files
    Last edited by flindy87; 06-04-2013 at 05:45 AM.

  4. #4
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Need help building a loop

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    05-28-2013
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: Need help building a loop

    Thanks very much,

    I gave the code a test, it seems to be pulling through the Position, rather than the Full name?

  6. #6
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Need help building a loop

    I thought that was a number

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    05-28-2013
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: Need help building a loop

    Really appreciate all your help, however i may have butchered the code a bit too much, it doesn't seem to work at all now - basically runs through the loop doing nothing. A specific line does not seem to be doing anything at all...."For Each Cell in rngRowToCheck.Cells"

    Please Login or Register  to view this content.

  8. #8
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Need help building a loop

    its cause you've change the "team*" to be "Team*" LCASE changes to lower case, therefore this will never be true, leave the t as lower case.

    uncomment the dim statements

    if at the top of the code you say Option Compare Text, then there is no need for the Lcase bit.

  9. #9
    Registered User
    Join Date
    05-28-2013
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: Need help building a loop

    Ok that has fixed part of the problem, the code now runs and correctly fills out team 1 with the correct team members, however the code then stops with a "Mismatch error" and does not fill out any other team.

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    05-28-2013
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: Need help building a loop

    Anyone able to help?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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