+ Reply to Thread
Results 1 to 3 of 3

failed loop code

Hybrid View

s4driver failed loop code 05-31-2013, 08:54 AM
JosephP Re: failed loop code 05-31-2013, 08:58 AM
Colin Legg Re: failed loop code 05-31-2013, 09:31 AM
  1. #1
    Forum Contributor
    Join Date
    09-12-2012
    Location
    Michigan
    MS-Off Ver
    Excel 2007
    Posts
    127

    failed loop code

    I have a macro in the attached file where I am taking selected data from the first 2 tabs and arranging it in the 3rd tab. I need another set of eyes to see why it doesn't loop thru all the rows on the first 2 tabs. It only makes it thru 1 or 2 loops. I have used this method before and it has always work just fine. the source tabs (first 2 tabs) need to remain as they are, no reformatting etc.

    thanks in advance, s4
    Attached Files Attached Files

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: failed loop code

    Set o = wsOBlogC.Range("D5:D" & Cells(Rows.Count, 4).End(xlUp).Row)
    oughta be
    Set o = wsOBlogC.Range("D5:D" & wsOBlogC.Cells(Rows.Count, 4).End(xlUp).Row)
    and the same for your 'set b =' line
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

    Re: failed loop code

    I guess you could go one step further and qualify the Rows property too, which would be important should the active sheet not be a worksheet.
    Set o = wsOBlogC.Range("D5:D" & wsOBlogC.Cells(wsOBlogC.Rows.Count, 4).End(xlUp).Row)
    Hope that helps,

    Colin

    RAD Excel Blog

+ 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