Hi everyone,
I've written a function and it works perfectly, but I'm having problems trying to loop it in a sub. Here is the function:
Basically it scans through the range and if the cell value is "SINGAPORE" or "Unknown Country", then it will sum up the cells next to it. So far so good.
Now on Sheet 1, I want to write a sub that loops this function for all the cells in a row. Here's my current code:
Here is what I want to achieve:
The value of Cell C1 = FHC(6)
The value of Cell C2 = FHC(9).....and so on until the end
However, when I run the sub, what happens is that VBA does C1 = FHC(6) and then FHC(9), before moving on to the next row and doing the same thing FHC(6) then FHC(9).
I'm quite stumped on how to fix this problem, and any help provided will be greatly appreciated. Thank you!
Bookmarks