ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Populate TextBox with other textbox value (https://www.excelbanter.com/excel-programming/444976-populate-textbox-other-textbox-value.html)

If[_3_]

Populate TextBox with other textbox value
 
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

isabelle

Populate TextBox with other textbox value
 
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


--
isabelle


If[_3_]

Populate TextBox with other textbox value
 
Hello Isabelle,

Big Thanks to you.

Yves


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







All times are GMT +1. The time now is 05:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com