UserForm1 get updated data from UserForm2

LongToast

New Member
Joined
Dec 1, 2021
Messages
32
Office Version
  1. 2003 or older
Platform
  1. Windows
Basically this is what i've done :

I have UserForm1 and UserForm2, on each that form i have a TextBox, what i want is anything CHANGE on TextBox in UserForm2, TextBox in UserForm1 get that value.

and this is what i have :

UserForm1 Code

VBA Code:
Me.TextBox1 = UserForm2.strClient
UserForm2.Show

UserForm2 Code

VBA Code:
Public strClient As String

Private Sub TextBox1_Change()
strClient = Me.TextBox1
End Sub

With those code i can only get value while UserForm2 Initialize (starting value) and after that, anything change in strClient will not update TextBox in UserForm1.

Thanks in advance.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
This works for me. The code goes on Userform2 for the TextBox that you want it to work on. Please change the names to suit your needs.

VBA Code:
Private Sub TextBox1_Change()
    UserForm1.TextBox1 = Me.TextBox1.Value
End Sub

In this case both forms had a "TextBox1".
 
Upvote 0
Solution
This works for me. The code goes on Userform2 for the TextBox that you want it to work on. Please change the names to suit your needs.

VBA Code:
Private Sub TextBox1_Change()
    UserForm1.TextBox1 = Me.TextBox1.Value
End Sub

In this case both forms had a "TextBox1".

I'm sorry for late response, i forgot to explain one thing :

Updated data in UserForm2 not only used by UserForm1 but used by other forms too, so multiple forms use that data, but it's modal (not multiple forms opened at a time), so i can't use UserForm1.TextBox1 = Me.TextBox1.Value in UserForm2 TextBox_Change Event.

I hope you can understand what i mean.

thanks.
 
Upvote 0
You are welcome. I am glad that you have solved your problem. I was happy to help.
 
Upvote 0

Forum statistics

Threads
1,214,943
Messages
6,122,369
Members
449,080
Latest member
Armadillos

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top