I need to make 2 lists:
1) With a list of 25 random people, i need to make each one a random male or female (designated by M or F). So in A2:A26 I have the numbers 1-25 designating a person but in B2:B26 I need a function that when the macro is run, it will randomly generate M and F for each.
This is what I had for this one but it lists all letters F through M:
Sub Gender()
Dim RandomRange As Range, cell As Range
Set RandomRange = Range("c2:c26")
For Each cell In RandomRange
cell.Formula = "=CHAR(RANDbetween(70,77))"
Next
RandomRange.Value = RandomRange.Value
End Sub
2) For C2:C26, I need to reference each person as smoker and non-smoker. Basically the same concept as before except instead of M and F, I need the full words "smoker" and "non-smoker.
Thanks in advance!
1) With a list of 25 random people, i need to make each one a random male or female (designated by M or F). So in A2:A26 I have the numbers 1-25 designating a person but in B2:B26 I need a function that when the macro is run, it will randomly generate M and F for each.
This is what I had for this one but it lists all letters F through M:
Sub Gender()
Dim RandomRange As Range, cell As Range
Set RandomRange = Range("c2:c26")
For Each cell In RandomRange
cell.Formula = "=CHAR(RANDbetween(70,77))"
Next
RandomRange.Value = RandomRange.Value
End Sub
2) For C2:C26, I need to reference each person as smoker and non-smoker. Basically the same concept as before except instead of M and F, I need the full words "smoker" and "non-smoker.
Thanks in advance!
Last edited: