Supppose i have more sheets and i need to include certain number of questions from each sheet, will the same code be good enough by changing only the sheet name.
Hi jindon, is it possible to run this code in endless loop, until i stop it manually, if yes could you please share the code.
I mean that upon running the macro it will continue showing a new set of questions every few seconds and the loop will never stop.
We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.
Please see Forum Rule #4 about hijacking and start a new thread for your query.
if i need to insert a question title before generating random questions from each sheet how do i do it..
for example:
I. Answer the following questions:
1.
2.
3.
4.
5.
6.
II. Choose the best answer:
7.
8.
9.
III. Answer in detail:
10.
11.
12.
If this example is the fixed part in column A so the easy way is to just allocate random in column B
and that's needs a tiny permutation code like next demonstration according to your attachment
(where you just need to modify the array variable V in order to fit your real workbook) :
PHP Code:
Private Sub CommandButton1_Click() Dim V, P&, C&, W, N&, R& V = [{"questions!A1:A14","B2:B7";"questions!A15:A22","B9:B11";"questions!A23:A30","B13:B15"}] For P = 1 To UBound(V) C = Application.Range(V(P, 1)).Count W = Evaluate("ROW(1:" & C & ")") For N = 0 To Range(V(P, 2)).Count - 1 R = Application.RandBetween(1, C - N) Range(V(P, 2))(N + 1).Value2 = Application.Range(V(P, 1))(W(R, 1)).Value2 W(R, 1) = W(C - N, 1) Next Next End Sub
Do you like it ? So thanks to click on bottom left star icon « ★ Add Reputation » !
Bookmarks