+ Reply to Thread
Results 1 to 7 of 7

Loop error

  1. #1
    Forum Contributor
    Join Date
    06-21-2013
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    186

    Loop error

    Gurus,

    I am attempting to read a list of employee names, create at worksheet, and rename the worksheet with the employees names. I get through the first loop but it stops at

    Please Login or Register  to view this content.
    On the second one. Below is the entire code. The error is run-time error '1004' Application-defined or object-defined error


    Please Login or Register  to view this content.
    Any Clues?

    TIA,
    Tim

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Loop error

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Forum Contributor
    Join Date
    06-21-2013
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    186

    Re: Loop error

    xladept,

    That didn't work... However, I did find out that when it looped to cells(5,2) the value was blank. Which is why I get an error during the renaming of the worksheet. But there is a name in cell b5..

    Stumped

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Loop error

    Tim

    You have not sheet reference for Cells(5,2) so it will refer to B5 on the active sheet and since you are creating new sheets that's probably going to be one of the new, blank sheets.

    Which sheet has the list of employee names?
    If posting code please use code tags, see here.

  5. #5
    Forum Contributor
    Join Date
    06-21-2013
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    186

    Re: Loop error

    Ohhhhh that makes sense.

    Employee list is on sheet("QP")

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Loop error

    Try this.
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    06-21-2013
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    186

    Re: Loop error

    Norie,

    Thanks for your code. I simply added the QP sheets in front of the cell value. It works just like I wanted. Here is what I ended up with.

    Please Login or Register  to view this content.
    Tim

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. trying to copy a worksheet to end gives error and I get stuck in a error loop
    By pongmeister in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-11-2017, 11:48 AM
  2. Replies: 5
    Last Post: 12-08-2016, 06:43 PM
  3. [SOLVED] Go to next loop iteration if current loop has error
    By luv2glyd in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 02-03-2016, 09:54 PM
  4. Loop Nesting is returning Run-Time Error '-2147221080 (800401a8)': Automation Error
    By ChristopherBrandonKi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-21-2014, 02:36 PM
  5. HOW TO: Pause loop, fix error on a popup UserForm, continue loop
    By AndyMachin in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-19-2014, 04:37 PM
  6. Nesting a loop within a loop error
    By PunPryde in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-17-2011, 08:07 PM
  7. Error '1004', application/object error, Do Loop
    By farzyness in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-25-2011, 12:03 PM

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