Assign random name to selected cell

  • I have a list of names in column A and what I would like to do is select an empty cell and have a macro assigned to a button that when pressed, assigns the random name to said cell. Repeating names are ok.

    Basically I will have a list of tasks and would want to assign a name, randomly, to each task. These tasks wouldn't be assigned in bulk, it would be one at a time as I receive them, enter them into my worksheet, and assign them.

    Any help would be greatly appreciated, thanks :)

  • Re: Assign random name to selected cell

    Quote from StephenR;769670

    Perhaps like so.

    Sub Button1_Click()
    With Range("A1").CurrentRegion
        ActiveCell = .Cells(WorksheetFunction.RandBetween(1, .Rows.Count))
    End With
    End Sub

    Thanks so much, this worked exactly like I needed

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!