Galileo1980
Programmer
Hello, the issue I'm having is that I have 2 columns on different worksheets that contain values that match to each other.
The easy ones are the 1:1 matching, simply take the first value, compare that to the other one and if they match do whatever needs to be done. I loop through the X values, I loop through the Y values and done. The difficult part is when it comes to 1:x matching, which means that 1 value in the first column may be made up by 4 values in the other column. Now in itself that is not a problem, it just requires a heck of a lot of nested loops (and time).
Is there a way to create a function that I can call subsequently and that would do one of the loops? This way I don't have to program all of my loops for 1:5 and could easily upscale to 1:10 if needed. What I was think is that I would pass on the X, Y, Z, AA, AB, AC value as a combined figure (deducting Y,Z from X to make AA match the entire calculation). I just need to know how to loop create a nested looped function.
I hope it's clear ;-)
The easy ones are the 1:1 matching, simply take the first value, compare that to the other one and if they match do whatever needs to be done. I loop through the X values, I loop through the Y values and done. The difficult part is when it comes to 1:x matching, which means that 1 value in the first column may be made up by 4 values in the other column. Now in itself that is not a problem, it just requires a heck of a lot of nested loops (and time).
Is there a way to create a function that I can call subsequently and that would do one of the loops? This way I don't have to program all of my loops for 1:5 and could easily upscale to 1:10 if needed. What I was think is that I would pass on the X, Y, Z, AA, AB, AC value as a combined figure (deducting Y,Z from X to make AA match the entire calculation). I just need to know how to loop create a nested looped function.
Code:
Function Looping (ValueToMatch)
For loop = 1 to OneInXMatching
x = cell.value
if ValueTomatch = x then perform_match_action
Looping (ValueToMatch - x)
Next loop
end function
I hope it's clear ;-)