
Originally Posted by
john55
maybe this, just try
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'click in any cell from a2 to a200 and the userform is populated...
If Target.Count > 1 Then Exit Sub
If Intersect(Target, Range("A2:A200")) Is Nothing Then Exit Sub
UserForm1.Show
End Sub
Private Sub UserForm_Initialize()
'read the data from active row
With Me
.TextBox1.Value = Cells(ActiveCell.Row, "A").Value
.TextBox2.Value = Cells(ActiveCell.Row, "B").Value
'more textboxes
'
'
End With
End Sub
the button for transfering yr dada
Private Sub CommandButton1_Click()
Cells(ActiveCell.Row, "A").Value = TextBox1.Value
Cells(ActiveCell.Row, "B").Value = TextBox2.Value
End Sub
Thanks John.
So bear with me here - the code you posted sucessfully brings up the UserForm...but what it doesn't yet seem to do is 'take up' the values of the row in question.
I have amended the particular routine so that the text box names match my own:
Private Sub UserForm_Initialize()
'read the data from active row
With Me
.cboDATE.Value = Cells(ActiveCell.Row, "A").Value
.cboREF.Value = Cells(ActiveCell.Row, "C").Value
.cboCI.Value = Cells(ActiveCell.Row, "D").Value
.age.Value = Cells(ActiveCell.Row, "E").Value
.ComboBox25.Value = Cells(ActiveCell.Row, "F").Value
.cboGEN.Value = Cells(ActiveCell.Row, "G").Value
'more textboxes
'
'
End With
End Sub
Thanks!
Bookmarks