detriez
Board Regular
- Joined
- Sep 13, 2011
- Messages
- 193
- Office Version
- 365
- Platform
- Windows
I am using this to populate a userform field with the value from the clicked cell and it works fine
I need to also populate another
I need to also populate another userform field with the value from another column
This did not work. No error, it just does not populate the userform fields
VBA Code:
Sub showform()
UserForm1.Show
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Selection.Count = 1 Then
If Not Intersect(Target, Range("A2:A2000")) Is Nothing Then
Call showform
End If
End If
End Sub
Code:
Private Sub UserForm_Activate()
TextBox3 = ActiveCell.value
End Sub
I need to also populate another
Code:
Private Sub UserForm_Activate()
Dim lRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Contacts")
lRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
With ws
Me.TextBox3.value = .Cells(lRow, 1).value
Me.TextBox14.value = .Cells(lRow, 2).value
End With
End Sub
I need to also populate another userform field with the value from another column
This did not work. No error, it just does not populate the userform fields
Code:
Private Sub UserForm_Activate()
Dim lRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Contacts")
lRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
With ws
Me.TextBox3.value = .Cells(lRow, 1).value
Me.TextBox14.value = .Cells(lRow, 2).value
End With
End Sub