Populate TextBox with other textbox value

I

If

Hello,


....
Private Sub UserForm_Initialize()
Me.UserName = Environ("username")
....


I have two textbox that I fill it based on the value of first textbox
(UserName)

Taking the data in a sheet called "Users" with fields (Username,
Name_FirstName, Phone)

Thanks in advance

Yves
 
I

isabelle

hello Yves,

Private Sub UserForm_Initialize()
Dim sUserName As String, x As Integer
sUserName = Environ("username")
With Sheets("Users")
If Not IsError(Application.Match(sUserName, .Range("A:A"), 0)) Then
x = Application.Match(sUserName, .Range("A:A"), 0)
TextBox1 = .Range("A" & x)
TextBox2 = .Range("B" & x)
TextBox3 = .Range("C" & x)
End If
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top