(Solved) – Randomly Assign Employees with Percentage to Tasks

  • by

I was working in a previous macro that makes me a lot of problems like (if #Tasks < #Employees) macro doesn't work, or like percent Values that I think does not work properly

I share a part of the macro that assign Employees to Tasks

Dim perc As Double

cnt = ActiveCell.Row - 1

If ThisWorkbook.Sheets("CATALOGO").Range("SUM_PERCENT").Value = 0.01 Then
i = 2
K = 2
perc = 0
Do While Cells(i, 1).Value <> ""
emp = Cells(i, 1).Value
perc = (Cells(i, 2).Value * cnt)   perc

For j = K To perc   1

Cells(K, 2).Value = emp
K = K   1

Next j
i = i   1
MsgBox "Asigne los porcentajes correctamente"
Exit Sub
End If

I really forgot where I found this macro, it was working fine for a while but then, this kind of problem when #Task lower than #Employees, macro does nothing

Then I found in the next post Randomly Assign Employees to Tasks in the comments,the [Command Button] one, a macro that works fine if (#Tasks < #Employees).
Credits to the owner @K.Dᴀᴠɪs

I would like to add a Percentage for each Employee in this other macro from previous post.

Can anyone help me with this?

Leave a Reply

Your email address will not be published. Required fields are marked *