+ Reply to Thread
Results 1 to 5 of 5

Looping through 2 different variable for different result

  1. #1
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    440

    Looping through 2 different variable for different result

    Hi,

    I wonder how to loop and control throught 2 different variables?

    Please Login or Register  to view this content.


    I mainly want the macro to do:
    Please Login or Register  to view this content.
    Do not consider the rngList.Cells, but more the mathematical way.

    Thanks.

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Looping through 2 different variable for different result

    Hi, calvinle,

    maybe
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    440

    Re: Looping through 2 different variable for different result

    That won't work because lngid ahould repeat 6 to 10 then repeat 6 to 10.

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Looping through 2 different variable for different result

    Hi, calvinle,

    you would need to attach a workbook as your explanation and the code provided do hardly match up at least leave aa lot of questions open on my part.

    Sorry for the code it should read like
    Please Login or Register  to view this content.
    I don´t know what went wrong when copying the code over here (must have been the wrong origin apparently).

    Ciao,
    Holger

  5. #5
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    440

    Re: Looping through 2 different variable for different result

    Hi,

    Thanks for willing to help me because I spent days trying to figure out this thing. I cannot upload a sample is because my vba is calling (getting data) from an external apps which you don't have.

    But here is the one that work so far but only for 1 page. If my client have 2 pages, I don't know how to change the value for the same action.

    Here is the one that work so far but only if the client have 1 page of data. If the client has more page of data, I will need to bring repeat this, however, the code:
    rngList.Cells(lngSrcIdx, 1).Value -> has to be the next empty row, otherwise it will just copy and paste the next page data on these same row (6 to 18)
    Please Login or Register  to view this content.
    This code work for 1 page, so if my client has 2 pages, I will need to copy and paste the code right next below:

    Please Login or Register  to view this content.
    But in this one, the code will be place in row 6 to 18, and then go to page 2, and replace the data to 6 to 18, which I don't want. I want the data to be placed in 19 to 31...

    And if my client has 10 pages, I will need to find a way to do so for 31 till end row.

    Thanks for heping.

+ 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. Looping through a variable with macro and autofilter
    By CLoos in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-20-2013, 06:06 PM
  2. Replies: 1
    Last Post: 10-27-2012, 02:54 AM
  3. Variable that can reset while looping
    By problematic in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-14-2012, 06:05 PM
  4. Looping an if statement with row number variable
    By Benisato in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-06-2011, 08:13 PM
  5. [SOLVED] (1) VARIABLE IN POSTING CODE (2) LOOPING
    By Robert in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-14-2005, 02:05 AM

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