Home > Forum Home > Automating Data Analysis Tasks > Looping Query using value from next cell | Share |
Forum Topic | Post Reply Login |
Looping Query Using Value From Next Cell | Rate this: (3/5 from 1 vote) |
I have query that loops a number of times depending on the number of rows in a column that contains data. I am having troubles figuring out how to make it use the first row of that column in the query VBA Code:
and then when it loops the next time use the 2nd row of that column VBA Code:
until it reaches the last row of that column and has returned all the data. | ||||
Posted by Torantis on |
Replies - Displaying 1 to 6 of 6 | Order Replies By: Most recent | Chronological | Highest Rated |
Rate this: (3/5 from 1 vote) | |
Posted by Torantis on |
Rate this: (3/5 from 1 vote) VBA Code:
The second issue could be due to the double quotes around the nxtval. Have you tried to remove them? | ||
Excel Business Forums Administrator | ||
Posted by Excel Helper on |
Rate this: (3/5 from 1 vote) Great that worked for me. Thank you. I had to get rid of my original loop because it would loop through then loop through again. One more thing on this. After I put this in and got rid of my other loop it seems to go through each cell with data then an additional one because it returns an error that I put into the sheet that if recordset = 0. I verified that all the data was returned for what was listed in that column and it was. Also tried to update a pivot table for this like.... VBA Code:
Gives error Unable to get the PivotItems property of the PivotField class. It does however under debug display the correct batch number. | ||
Posted by Torantis on |
Rate this: (3/5 from 1 vote) | |
Excel Business Forums Administrator | |
Posted by Excel Helper on |
Rate this: (3/5 from 1 vote) | |
Posted by Torantis on |
Rate this: (3/5 from 1 vote) VBA Code:
| ||
Excel Business Forums Administrator | ||
Posted by Excel Helper on |
Displaying page 1 of 1 |
Find relevant Excel templates and add-ins for Looping Query using value from next cell in the Excel Business Solutions Directory |