Hi all,
I want to choose a name at random from a list.
I was able to get the formula that makes this selection possible.
Now I'd like it to be a macro and a button. On which I can press and display the result.
How do I implement this by macro and set up the button?
Also, is it possible in the formula for the number of rows to be infinite, but not limited to a given range of rows?
Thanks,
[Solved] Random name picker by macro
[Solved] Random name picker by macro
- Attachments
-
- 123.ods
- (14.95 KiB) Downloaded 36 times
Last edited by MrProgrammer on Mon Mar 11, 2024 10:15 pm, edited 1 time in total.
Reason: Tagged ✓ [Solved] Example provided -- MrProgrammer, forum moderator
Reason: Tagged ✓ [Solved] Example provided -- MrProgrammer, forum moderator
OpenOffice 4.1.12 on Windows 10
- MrProgrammer
- Moderator
- Posts: 4909
- Joined: Fri Jun 04, 2010 7:57 pm
- Location: Wisconsin, USA
Re: Random Name Picker by macro
[Tutorial] Randomization in Calc
This attachment demonstrates how to do that. When you want to choose a new name press Ctrl+Shift+F9 (⌘⇧F9 on Mac) and then copy the number (not the formula) from D2 to C2.
Just record a macro to perform those steps.
• Tools → Macros → Record Macro
• Press Ctrl+Shift+F9 (⌘⇧F9 on Mac)
• Click cell D2 in my attachment
• Edit → Copy
• Click cell C2
• Edit → Paste Special → Selection:Numbers (only) → Options:None → Operations:None → ShiftCells:Don't → OK
• Stop Recording
• Give your macro a name and save it
To run your macro use Tools → Macros → Run Macro.
[Tutorial] Favorite Recorded Calc Macros
Button controls are a nuisance in Calc, but if you want you can use a toolbar button.
[Tutorial] Binding a macro: Shortcut key, menu or toolbar
No spreadsheet supports an infinite number of rows. My attachment allows for 1000 names, which you can increase if needed.
If this solved your problem please go to your first post use the Edit ☐ button and add [Solved] to the start of the Subject field. Select the green checkmark icon at the same time.
[Tutorial] Ten concepts that every Calc user should know
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel. The locale for any menus or Calc formulas in my posts is English (USA).
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel. The locale for any menus or Calc formulas in my posts is English (USA).
Re: Random Name Picker by macro
As currently set up, the cell C3 in 123.odt will display a new name every time you press Ctrl + Shift + F9. Is that all you want from a button and macro?
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.