I am trying to use double-click event of worksheet to populate a textbox in a form with value from a specific column in the double-clicked row.
e.g.
I have four columns
ID Name Age Gender
1 A 24 M
2 B 26 F
3 C 22 F
4 D 30 M
When I double-click on any cell in the column Name
, a form with a textbox will pop up with the textbox filled with the value from the column Gender
in the row which was double-clicked. SO when I double-click on "B" in column Name a form should pop up with textbox value "F".
this is my code so far
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, CANCEL As Boolean)
CANCEL = True
If Target.Column = 2 Then
Update.Show
With Update.TextBox1.value = ?????
End With
End If
End Sub
I used the double click event to open the form & form activate event to fetch the value from the column in the active cell row
so its basically
Using a form called
frm_Update
with three appropriately named text box controls.This will take the value from the
Target
row, columns 2, 3 and 4 and place the values in the textboxes:@Comintern - I'm going to have a good read of that link. All stuff I really should put into practice.