Hi Guys,
I search the forum and the internet but could not find the solution, I have mulitple rows (number of rows chane each month)
which must be split between staff (number of staff change each month),
I found on the forum piece of code whi sligtly modified (Thank you for the author)
I need to colour rows equally to each person so they can work at the same time on the master file.
Could someone have a look please, I tried to split column A to number of people but this is not want I want to achieve
I1 = Number of rows
J1 = Number of staff
K1 = Number of rows for each rounded up
I have no idea how to colour
I search the forum and the internet but could not find the solution, I have mulitple rows (number of rows chane each month)
which must be split between staff (number of staff change each month),
I found on the forum piece of code whi sligtly modified (Thank you for the author)
I need to colour rows equally to each person so they can work at the same time on the master file.
Could someone have a look please, I tried to split column A to number of people but this is not want I want to achieve
I1 = Number of rows
J1 = Number of staff
K1 = Number of rows for each rounded up
I have no idea how to colour
VBA Code:
Sub count_rows()
'1. Check how many rows per person
Dim count As Long
count = ActiveSheet.Range("D2", ActiveSheet.Cells(Rows.count, "D").End(xlUp)).count
' MsgBox count
MyVector = Range("I1").Resize(count).Value
Range("I1").Value = count
Range("K1").FormulaR1C1 = "=ROUNDUP((RC[-2]/RC[-1]),0)"
' 2. Split into cells
Dim X As Long, LastRow As Long, vArrIn As Variant, vArrOut As Variant
Dim Num_rows As Range
Set Num_rows = Range("K1")
LastRow = Cells(Rows.count, 1).End(xlUp).row
vArrIn = Range("A1:A" & LastRow)
ReDim vArrOut(1 To Num_rows, 1 To Int(LastRow / Num_rows) + 1)
For X = 0 To LastRow - 1
vArrOut(1 + (X Mod Num_rows), 1 + Int(X / Num_rows)) = vArrIn(X + 1, 1)
Next
Range("M2").Resize(Num_rows, UBound(vArrOut, 2)) = vArrOut
Range("M2").Select
Selection.Delete Shift:=xlUp
End Sub