I have created a form and has two command buttons, Say A and B.
Command button A uses random number generator to select a cell from a range in the spread sheet which is then used in vlookup function to return a value from column number 2 of a record in text box1.
I would like the Command button B to return the value from column number 3 for the same record in text box2.
Kindly advise how can I do it.
The code for Command button A looks like:
Private Sub CommandButton3_Click()
Dim LRandomNumber As Integer
Dim Meaning As String
Dim Word As String
LRandomNumber = Int((50 - 1 + 1) * Rnd + 1)
TextBox1.Value = Application.WorksheetFunction.VLookup(LRandomNumber, Sheet1.Range("A1:B51"), 2, True)
End Sub
Bookmarks