To be more precise :
Row A contains names of invigilators this can vary in terms of numbers. Row 1 has the dates of exams, the number of exam can vary too. Hence the need for user to higlight cells to form the table.....in this case the table would start at B2 to L10.
In the table B2 to L10, some cells will contain 1 and some 0 and some blank.
I need a VBA that will randomly insert 1s in blank cells such that for e.g the sum of column B of the table must be equal to B11, which is fixed by me. While at the same time the sum of each row of the table is given by the cell value C18 in this case is 8.
Cell value in C18 will always be adjusted by me to ensure that it is possible to randomly assign 1 in the empty cells so that the sum of the row corresponds to value C18 and the sum of the column corresponds to row 11.
It will be great if the vba can also count the sum of the row and place it in the column adjacent to the table.....in this case Column M.
I tried several VBAs but can only manage to get it to randomly insert 1s and meet the sum of row or sum of column criteria but NOT BOTH. In the picture, this VBA inserted 1 randomly and was able to meet the criteria for the sum of each column.....but can't meet the criteria where the sum of the rows, in this case should be 8.
I hope some kind soul can help.
Thanks.