Hello See there with macro replace 7 with 15 and 49 with 15
soubisien85
On the other hand, while I think of it, could you please tell me how to insert the button that triggers the macro? That would be nice. Thank you
Happy New Year
Best regards SOUBISIEN
soubisien85
I don't see "form design" Is there no formula in addition to the bound randomness that could help me?
Thank you
Best regards Soubisien85
yclik
Re The only formula does not eliminate duplicates; a macro is needed. The hidden sheet is unnecessary and can be deleted. Format>sheet...>Show then delete the sheet
in the macro modify oSheet = ThisComponent.Sheets(1) replace 1 with 0
to display the macro ALT+F11 search for the workbook in the tree and select it +Standard -- module 1 "Edit" button
to create a button View>toolbar>Form control Activate the form draft via the square icon
Draw a button with the "Button" tool
assign a macro Once drawn Select it right click>Control>Tab "Event" Select "Run action" "macro" button select the macro:
search for the workbook in the tree and select it +Standard -- module 1 select "Drawing" and "OK" button "OK" button
cancel the form draft via the square icon
soubisien85
Good evening,
I apologize, but I don't understand the macro oSheet = ThisComponent.Sheets(1) replace 1 with 0 I thought I would record a macro with randomness... At what point should I modify and where?
Sub Tirage_col_I Dim i Dim j Dim val Dim match oSheet = ThisComponent.Sheets(0)
rem 15 is equal to the number of cells to fill rem 8 = col I For i = 1 To 15 oCell = oSheet.getCellByPosition(8,i) Do match = False rem nb int(rnd()*xx) gives the limit val = int(rnd()*49) + 1 For j = 1 To i If val = oSheet.getCellByPosition(1,j).getValue() Then match = True End If Next j Loop Until (match = False) oCell.setValue(val) Next i End Sub