![]() |
|
#1
|
|||
|
|||
|
Hello everyone, I wonder if there is anyone who can help me please. From a list of 10 names manually inserted in a spreadsheet I want to invoke a macro by pressing a button (I know how to do this bit). The macro will then randomly a number using the RANDBETWEEN function and highlight the corresponding name in the spreadsheet (this is the bit I don't know how to do). Ideally I'd like the random selection to be relatively evenly spread across the 10 names but don't know if this is possible to control using a random function. |
|
#2
|
|||
|
|||
|
Try something like this
Code:
Sub Randomly_generate_a_number_between_1_and_10_inclusive()
'
' Macro1 Macro
Range("b:b").Interior.Color = xlNone
randnum = WorksheetFunction.RandBetween(1, 10)
'
Range("D2") = randnum
Range("A:A").Find(what:=randnum, LookIn:=xlValues, lookat:=xlWhole).Offset(0, 1).Interior.Color = vbYellow
End Sub
|
|
#3
|
||||
|
||||
|
Mixed messages in your file (button text) and the narrative in msg#1!
In the attached 3 buttons doing various things, each calling a one-line macro, along with some conditional formatting on the sheet. More explanations in the attached. |
|
#4
|
|||
|
|||
|
OK guys thanks very much for your help
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
RANDBETWEEN question
|
derohanes | Excel | 3 | 01-25-2019 09:38 AM |
Calculating bonus in an embedded IF function
|
Yde1203 | Excel Programming | 2 | 07-22-2018 08:24 AM |
| RandBetween for PowerPoint | excelledsoftware | PowerPoint | 1 | 09-19-2014 11:32 PM |
RandBetween Formula Help
|
acbh | Excel | 1 | 09-12-2013 06:51 PM |
word macro that reformats embedded links in a doc
|
EricT | Word VBA | 7 | 09-12-2012 04:13 PM |