PDA

View Full Version : Loop to combine data in 2 columns and insert string every 145 combinations



b.hill
07-05-2013, 08:33 AM
I have 2 columns of data (columns A and B). Each column has 1042 rows of data (rows 2 through 1043). I am trying to perform the following steps. It should end up creating 543,403 combinations.

1) For each row in column A, divide the data in A with every row of data in column B starting with Offset(0,1) from the current row in column A.

For example, the data point in A10 would end up being divided by B10,B11,B12……B1043. Each division is one combination, so A10/B10 is one combination, A10/B11 is another, etc.

2) For every 145 combinations created, I need to insert the value into a website. I can already put the data into the website as long as I can use a string, but I don’t know how to get the above process to input the string after every 145 combinations and then pick up where it left off with the combinations. Maybe it would be best to set the string every time as the current combination and input 145 times.

Thank you in advance.

SamT
07-05-2013, 11:53 AM
For each CelA in Range("A2:A" & LastRowA)
b=145
Do
Val = Cstr(CelA + Range("B" & b))
'Put Val on Website
b= b+145
Loop until b > LastRowA
Next CelA