+ Reply to Thread
Results 1 to 5 of 5

Loop instructions for number of active rows

  1. #1
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,173

    Loop instructions for number of active rows

    This is a two part quesition.

    First: I am using following loop code to repeat until the last row with data in column B has been reached. I keep getting a compile error and can't figure out to to fix it. The compile error occurs on the ".cell" and ".range" portion of the code and has indicated an invalid or unqualified reference.

    Second: Once I have the loop working, I need to reference different cells each time through the loop. The first time through the loop I need to reference cells B2 and C2....the second time cells B3 and C3.....and then B4 and C4....and so on. I am increasing the value of i each time but when I ran the code, I was not getting any results.
    Please Login or Register  to view this content.
    Last edited by maacmaac; 11-21-2008 at 10:30 AM.

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    1) As you haven't nominated a with statement, then you don't need the .cells or .range approach. Remove the . from the reference.

    2) To cycle through the range of row numbers try

    Please Login or Register  to view this content.
    3) I'm not really sure what you are trying to do with the rest of the code. If the above don't get you going, then perhaps try to explain what you want it to do.....

    rylo

  3. #3
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,173
    That works for part 1.

    Still having a problem with part 2 of question.

    The way the code should look through the first cycle is as such:
    Please Login or Register  to view this content.
    The way the code should look through the second cycle is as such:
    Please Login or Register  to view this content.
    So as the code loops it first looks at the data that is stored in B2 & C2 and returns a value in D2. Then it repeats for row 3, 4, 5, 6, 7, ...... and so on until it reaches the last row.

    Hope this makes more since. I have attached a copy of the file with all the code and how the page is layed out if needed. Thanks for the help.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    Try using this command line

    Please Login or Register  to view this content.
    It failed for me as I don't have pWinHttpRequest

    rylo

  5. #5
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,173
    That's the trick. Works like a charm now. I also had to update code two lines below. Final working code is as follows:
    Please Login or Register  to view this content.
    Thanks for all the help.

+ 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