Cld you answer me few questions from your code?
Sub Macro1()
m=4
n=6
taskfinder() // Simply replace it with Call taskfinder.
end sub
Public Sub taskfinder()
task = 1
For i = 1 To n
For j = 1 To m
TF(i) = TF(i) + 1 //Is TF an array?
If it is then it wld work, you just need to declare one global array as TF.
Next
iif(TF(i)<TF(task),task=i,task=task)
Next
End Sub